I'm making a multiplayer game with a node.js server with socket.io and a html5 canvas with a js file in it for client.
Now I have the
socket.on('disconnect',function(){my code here});
on server side, but when a user closes the tab the client is running in it doesn't trigger any disconnect event in the server, but I need the server to notice when a user closes the tab.
How can I make the client trigger the event correctly when one closes the tab it's running in?