Reputation: 1320
How does the server know when the client suddenly dies/disconnects due to network/power failure in SocketIO. Since the client wont have any chance to emit a disconnect event to the server... is there any way to solve this issue?
Upvotes: 1
Views: 143
Reputation: 17828
Socket.io has an internal keep alive mechanism. If a client disconnects abruptly, the server doesn't know about it immediately. Instead, when the next keep alive mechanism event will fire and no response will arrive within the time limit, the server will fire disconnect event for that client. The time it takes for the server to detect a client disconnected is affected from the keep alive polling intervals and the timeout limit.
You can change those values using 'pingInterval' and 'pingTimeout', which will change the way engine.io is configured.
Upvotes: 2