Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/SignalR/clients/ts/signalr/src/HubConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,12 @@ export class HubConnection {
{
let nextPing = this._nextKeepAlive - new Date().getTime();
if (nextPing < 0) {
nextPing = 0;
if (this._connectionState === HubConnectionState.Connected) {
this._sendMessage(this._cachedPingMessage).catch((e) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is different from what you showed me. The check is now inside the if (this._pingServerHandle === undefined) condition, but isn't the problem that we set a timer but it isn't being fired? So this new code will never be hit in the problematic case?

this._logger.log(LogLevel.Warning, "Error sending keep-alive message" + e);
});
return;
}
}

// The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute
Expand Down
Loading