How to tell if someone hasn't been working with a piece of software in production yet? They've never blamed a bug on cosmic radiation yet :D
https://socket.io/docs/v4/how-it-works/
See disconnection detection section
https://socket.io/docs/v4/how-it-works/#disconnection-detect... says:
> At a given interval (the `pingInterval` value sent in the handshake) the server sends a PING packet and the client has a few seconds (the `pingTimeout` value) to send a PONG packet back. If the server does not receive a PONG packet back, it will consider that the connection is closed.
So far this describes what we've already been doing prior to the fix mentioned in the blog post. However, this next sentence is where Socket.io's solution diverts from ours:
> Conversely, if the client does not receive a PING packet within `pingInterval + pingTimeout`, it will consider that the connection is closed.
Indeed looks like a solid way to solve the client-side recognition of a broken connection!
--
That said, I'm a little confused because I cannot find any mention of `pingTimeout` in their JS client [0], and `pingInterval` is only mentioned in an implementation of a test server [1]. I wonder if I'm looking at the wrong thing.
[0]: https://github.com/socketio/socket.io-client/search?q=pingti...
[1]: https://github.com/socketio/socket.io-client/search?q=pingin...
I do wish we didn't all have to reinvent this wheel though…
Such a good insight -- seems obvious, but too often the source of gotchas, bad data, and bad user experience.
It’s application layer keepalive.