Check connection state in ping Typescript client (#2753)
This commit is contained in:
parent
02d1d4b1aa
commit
cef7dfcdbb
|
|
@ -406,7 +406,11 @@ export class HubConnection {
|
|||
|
||||
private resetKeepAliveInterval() {
|
||||
this.cleanupPingTimer();
|
||||
this.pingServerHandle = setTimeout(() => this.sendMessage(this.cachedPingMessage), this.keepAliveIntervalInMilliseconds);
|
||||
this.pingServerHandle = setTimeout(async () => {
|
||||
if (this.connectionState === HubConnectionState.Connected) {
|
||||
await this.sendMessage(this.cachedPingMessage);
|
||||
}
|
||||
}, this.keepAliveIntervalInMilliseconds);
|
||||
}
|
||||
|
||||
private resetTimeoutPeriod() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue