-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Send Keep-Alive Ping Immediately When Previous Ping Is Overdue #63195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+21
−8
Conversation
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
@dotnet-policy-service agree company="Microsoft" |
BrennanConroy
approved these changes
Aug 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-signalr
Includes: SignalR clients and servers
community-contribution
Indicates that the PR has been added by a community member
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.
Send Keep-Alive Ping Immediately When Previous Ping Is Overdue
Trigger Client-to-Server Keep-Alive ping immediately if nextPing is overdue. The behavior should remain in parity as sending it immediately vs adding it to setTimeout with 0 delay are the same.
Description
We've observed that some browser clients occasionally enter a hidden (but not frozen) state, during which JavaScript timers are paused. As a result, the Client-to-Server Keep-Alive ping fails to fire, causing the server to reach the ClientTimeoutInterval and disconnect the client.
The client then attempts to reconnect, but because the browser remains in a hidden state, setTimeout continues to be paused, preventing the ping from firing again. This leads to repeated disconnections and reconnections until the browser either becomes frozen or returns to an active state. This behavior results in unnecessary reconnect traffic on the server.
Note: The frozen state works as expected, where Server will disconnect Client once the ClientTimeoutInterval has been exceeded. And the Client will not reconnect until the browser is unfrozen.
This issue doesn't occur consistently across all hidden browser states. We suspect it may be influenced by the following,
We've patched our SignalR client (v8.0.7) to immediately fire the Keep-Alive ping if nextPing is in the past, rather than relying on setTimeout, which may be paused. This change helped resolve the repeated reconnections for such sessions.
{Detail}