feat: add a "connection_disrupted" mode while server wait for client reconnect#2789
Merged
feat: add a "connection_disrupted" mode while server wait for client reconnect#2789
Conversation
…t and during the server re-connect grace time - wsClientHost sends a "server-lost-client-state" or "server-connection-restored" to a reconnecting client to inform it of its server state - set shorter default reconnect times to ws client - add a close method the WsClientHost
barak007
reviewed
Nov 16, 2025
barak007
reviewed
Nov 16, 2025
barak007
reviewed
Nov 16, 2025
barak007
approved these changes
Nov 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a graceful reconnection mechanism for WebSockets, improving resilience during transient disconnects.
Key Changes
connection_disruptedEmitted immediately when a client disconnects before the server begins the disposal grace period.
Instead of disposing clients immediately on disconnect, the server now waits for a configurable grace period (
disposeGraceMs, default: 2 minutes).During this period the server tracks a queue of messages that would have been sent to the client.
When a client reconnects:
'ready'messages to transition them out ofpending.'server-connection-restored'message is sent to notify the client.'server-lost-client-state'message is sent, signaling that the client must refresh state.Additionally the timout and reconnection setting on the server socket has been set to lower defaults to all fast reconnect.