Add client ping stuff

This commit is contained in:
Schuyler Cebulskie
2016-12-02 20:58:19 -05:00
parent 2488e1a00f
commit 58c7c2e7b8
3 changed files with 26 additions and 1 deletions

View File

@@ -82,7 +82,10 @@ class WebSocketPacketManager {
return false;
}
if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) this.ws.client.emit('debug', 'Heartbeat acknowledged');
if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) {
this.ws.client._pong(this.ws.client._pingTimestamp);
this.ws.client.emit('debug', 'Heartbeat acknowledged');
}
if (this.ws.status === Constants.Status.RECONNECTING) {
this.ws.reconnecting = false;