nodejs-websocket
nodejs-websocket copied to clipboard
How would I handle an error when a client disconnects?
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.
conn.on("error", function (code, reason) { console.log("error msg") });