Best way to detect D/C?

I can’t speak to how socket.io works, but in my client I use a combination of 1 and 2: Only if there is inactivity it will send a PING to the server to check if the inactivity is caused by a disconnect. When there is any kind of traffic on the connection there’s no reason to check. The server does answer to PINGs, although even if it wouldn’t, just trying to send something on the socket usually shows that it’s no longer connected (at least for what I’ve been using in Java).

1 Like