cordova-plugin-websocket-server
cordova-plugin-websocket-server copied to clipboard
Not serving/connecting on Android 9
The server starts (onStart called) but it's not visible to any WebSocket clients, not even in the same phone. Error callback is not called. Creating the server works on a different Android version, but connecting the Android 9 device to it doesn't work either. It's not a WebSocket client problem, since connecting to a test server works.
Test Codes:
- Server:
wsserver.start(5457, {
'onFailure': console.log,
'onOpen': onClientConnected,
'onMessage': onClientMessage,
'onClose': onClientDisconnected,
'tcpNoDelay': true
}, function onStart(addr, port) {
console.log('Server started.', addr, port);
}, function onDidNotStart(reason) {
console.log('Server not started. Reason: ' + reason);
});
- Client (connecting to local server):
client = new WebSocket('ws://192.168.x.xxx:5457');
//readyState: CLOSED, code: 1006
- Client (connecting to test server):
client = new WebSocket('wss://demo.piesocket.com/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm¬ify_self')
//message: {"info":"You are using a test api key"}