Ignore failures from sending ping (#2840)

This commit is contained in:
BrennanConroy 2018-08-22 10:36:36 -07:00 committed by GitHub
parent db3f3f2a53
commit 5f4d0dac3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -408,7 +408,13 @@ export class HubConnection {
this.cleanupPingTimer();
this.pingServerHandle = setTimeout(async () => {
if (this.connectionState === HubConnectionState.Connected) {
await this.sendMessage(this.cachedPingMessage);
try {
await this.sendMessage(this.cachedPingMessage);
} catch {
// We don't care about the error. It should be seen elsewhere in the client.
// The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering
this.cleanupPingTimer();
}
}
}, this.keepAliveIntervalInMilliseconds);
}