I have a chat application on Node.js and Socket.io, user can connect and disconnect with a button...
I am having a list of online users which is perfectly managed with the help of my defined events that user trigger.
But the problem is I am unable to detect if the user has lost his connection or closed the browser window without disconnecting himself manually(by the disconnect button)...
This socket.io event is fired only when user disconnects himself not when he lost his connection.
socket.on('disconnect',function(){
console.log('user disconnected'); });
I want some really good mechanism to keep an eye on users in order to update my Online users list.