Skip to content

One ping/pong failure will make the websocket disconnect, is that too sensitive ? #4161

Answered by darrachequesne
qiulang asked this question in Q&A
Discussion options

You must be logged in to vote

why doesn't the heartbeat mechanism add some re-try before it marks the websocket disconnect ?

That's a good question. If a ping/pong fails, then the WebSocket connection is surely in an invalid state, and thus retrying will only delay the reconnection.

I assume after a ping/pong failure socket.io will use a new websocket to reconnect

Yes, that's right. The codebase is split in two projects:

  • Engine.IO: the engine.io-client package provides a WebSocket-like object, which falls back to HTTP long-polling (but no reconnection, similarly to the WebSocket API). The heartbeat mechanism happens here, and the connection gets closed if the heartbeat fails.

Source: https://github.com/socketio/…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@qiulang
Comment options

Answer selected by qiulang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants