Hi was trying to send some data back and forth, and I found out that when I closed my client my server crashed...
My Server is Node.JS using the nodejs-websocket library.
Then I found out you had to add this.
window.onbeforeunload = function() {
connection.close()
}
Is there away around this? Because if someone wanted to crash your server couldn't he just remove that from the JavaScript?
Please keep in mind this is my first time using websockets
Server Side:
var ws = require("nodejs-websocket");
var server = ws.createServer(function(conn){
console.log("New connection")
conn.on("end", function(code,reason){
console.log('Connection Lost')
});
}).listen(8001);
Error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:1018:11)
at TCP.onread (net.js:568:26)