I received this error:
Error: Uncaught, unspecified 'error' event.
at WebSocket.EventEmitter.emit (events.js:73:15)
at Receiver.self._receiver.onerror (C:\programing\project\node_modules\ws\lib\WebSocket.js:566:10)
at Receiver.error (C:\programing\project\node_modules\ws\lib\Receiver.js:301:8)
at Receiver.processPacket (C:\programing\project\node_modules\ws\lib\Receiver.js:198:12)
at Receiver.add (C:\programing\project\node_modules\ws\lib\Receiver.js:89:3)
at Socket.firstHandler (C:\programing\project\node_modules\ws\lib\WebSocket.js:524:22)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)
node-webkit seems to run for up to 2 to 4 hours, then I receive that error stated above. I am not sure if my wifly module is timing out causing a premature disconnect while the node-webkit is attempting to send a packet back to the wifly module. Or if the the packet being sent over web-socket protocal-76 is corrupt causing the webkit module to not understanding what is being sent? What should I do to fix this error?
websocket code:
var WebSocketServer = require('ws').Server, wss = new WebSocketServer({
port : 8080
});
wss.on('connection', function(ws) {
alert('connected!');
ws.on('message', function(message) {
//alert(message);
$('#wsData').val(message);
//console.log('received: %s', message);
});
ws.send('something', function(error){
alert('Send error' + error);
});
});
After adding:
ws.on('error', function(error) { console.log(error); });
I receive the message: reserved fields must be empty index.html:50
Line 50 code: console.log(error);