Socket.IO server pingTimeout shorter than client reconnectionDelayMax causes premature disconnects
0 reputation · 12 Jul 2025, 09:53 UTC
Socket.IO's server-side pingTimeout and pingInterval govern heartbeat detection, while the client's reconnectionDelayMax caps exponential backoff during reconnection attempts. When pingTimeout is configured below reconnectionDelayMax, the server may terminate a connection before the client's backoff reaches its maximum, creating a race between server-side cleanup and client-side retry scheduling. This interaction is not explicitly documented in the Socket.IO or Engine.IO guides.
The goal is to clarify whether the server's pingTimeout effectively overrides the client's configured backoff ceiling, and how the client's randomizationFactor (default 0.5) influences the probability of a reconnection attempt landing within the server's heartbeat window. Assume current socket.io and engine.io releases; behavior may vary across language implementations.
Does the server enforce pingTimeout independently of the client's reconnectionDelayMax, potentially aborting a connection the client still considers recoverable? Can the client's randomizationFactor be tuned to reduce collision with the server's heartbeat window without disabling jitter entirely? Is there a recommended ratio or formula linking pingTimeout, pingInterval, reconnectionDelay, and reconnectionDelayMax for stable operation under intermittent latency?