nodejs-websocket icon indicating copy to clipboard operation
nodejs-websocket copied to clipboard

How would I handle an error when a client disconnects?

Open nitroxplunge opened this issue 8 years ago • 1 comments

I have a node.js server that interfaces with a website, and when I close a tab the server crashes due to an "Unhandled 'error' event"

I assume I need to add an error handler after .listen() but I cant figure out how to do it.

I know this is a noob question but I'm still learning about websockets.

nitroxplunge avatar Nov 04 '17 21:11 nitroxplunge

conn.on("error", function (code, reason) { console.log("error msg") });

ghost avatar Oct 23 '18 10:10 ghost