mirror of
https://github.com/Cameri/nostream.git
synced 2025-03-17 21:31:48 +01:00
chore: handle pings
This commit is contained in:
parent
64432e6433
commit
cef12fd0be
@ -81,6 +81,7 @@ export class WebSocketAdapter extends EventEmitter implements IWebSocketAdapter
|
||||
.on('message', this.onClientMessage.bind(this))
|
||||
.on('close', this.onClientClose.bind(this))
|
||||
.on('pong', this.onClientPong.bind(this))
|
||||
.on('ping', this.onClientPing.bind(this))
|
||||
|
||||
this
|
||||
.on(WebSocketAdapterEvent.Heartbeat, this.onHeartbeat.bind(this))
|
||||
@ -258,6 +259,12 @@ export class WebSocketAdapter extends EventEmitter implements IWebSocketAdapter
|
||||
this.alive = true
|
||||
}
|
||||
|
||||
private onClientPing(data: any) {
|
||||
debugHeartbeat('client %s ping', this.clientId)
|
||||
this.client.pong(data)
|
||||
this.alive = true
|
||||
}
|
||||
|
||||
private onClientClose() {
|
||||
this.alive = false
|
||||
this.subscriptions.clear()
|
||||
|
Loading…
x
Reference in New Issue
Block a user