Skip to content

Commit

Permalink
fix: client socket should send keepAlives
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Jun 22, 2020
1 parent a88dc18 commit 88534e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Ember/Socket/S101Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export default class S101Client extends S101Socket {
return super.disconnect(timeout)
}

handleClose() {
if (this.keepaliveIntervalTimer) clearInterval(this.keepaliveIntervalTimer)
this.socket?.destroy()
}

_autoReconnectionAttempt() {
if (this._autoReconnect) {
if (this._reconnectAttempts > 0) {
Expand Down Expand Up @@ -140,6 +145,7 @@ export default class S101Client extends S101Socket {

private _onConnect() {
this._clearConnectionAttemptTimer()
this.startKeepAlive()
// this._sentKeepalive = Date.now()
// this._receivedKeepalive = this._sentKeepalive + 1 // for some reason keepalive doesn't return directly after conn.
this.status = ConnectionStatus.Connected
Expand Down

0 comments on commit 88534e2

Please sign in to comment.