I'm trying to replicate the simple example in the readme. But when i refresh the page i get the following error...
/usr/lib/node_modules/ws/lib/WebSocket.js:187
else throw new Error('not opened');
^
Error: not opened
at WebSocket.send (/usr/lib/node_modules/ws/lib/WebSocket.js:187:16)
at /var/lib/cloud9/eventrecorder/server.js:22:7
at f.digitalRead.readFile (/usr/lib/node_modules/bonescript/index.js:355:13)
at fs.readFile (fs.js:176:14)
at Object.oncomplete (fs.js:297:15)
Any suggestions?
Found a similar issue: https://github.com/primus/primus/issues/65
I've tried it with the code below but the problem remains. Need to check on a stable channel. I've used FF Nightly.
window.onbeforeunload = function(e) {
ws.close();
};
As written in the manual:
try {
ws.send(data);
}
catch (e) {
// handle error
}
You can use a callback to catch this error:
ws.send(data, function data(err) {
if (err) handleError(err);
});
Most helpful comment
You can use a callback to catch this error: