Reputation: 1
Trying to connect to a credit cart swiping machine using websockets. i am using react native as a POS application. I am getting the following error when i try with iOS (ipad).
{"code": 1006, "isTrusted": false, "reason": "The operation couldn’t be completed. (OSStatus error -9807.)"}
Code:
const ws = new WebSocket('wss://192.168.1.2:8443');
ws.onopen = () => {
console.log("Connection Established")
ws.send('Initiate Payment');
};
ws.onmessage = e => {
console.log(e.data)
}
ws.onerror = e => {
console.log(e.message);
}
ws.onclose = e => {
console.log(e, e.code, e.reason);
}
"react": "18.2.0", "react-native": "0.74.0",
I tried connecting through postman and i am successfully able to make connection
Upvotes: 0
Views: 185
Reputation: 1
wss need a certificate. this wont work with the regular WebSocket provided by react-native
Upvotes: 0