fix heartbeats once and for all (#1016)

This commit is contained in:
Gus Caplan
2016-12-25 10:28:36 -06:00
committed by Amish Shah
parent fb6a8d1637
commit 2410fdf8d2
6 changed files with 25 additions and 18 deletions

View File

@@ -84,6 +84,7 @@ class WebSocketPacketManager {
if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) {
this.ws.client._pong(this.ws.client._pingTimestamp);
this.ws.lastHeartbeatAck = true;
this.ws.client.emit('debug', 'Heartbeat acknowledged');
}

View File

@@ -16,6 +16,8 @@ class GuildMembersChunkHandler extends AbstractHandler {
guild._checkChunks();
client.emit(Constants.Events.GUILD_MEMBERS_CHUNK, members);
client.ws.lastHeartbeatAck = true;
}
}

View File

@@ -7,7 +7,7 @@ class ReadyHandler extends AbstractHandler {
const client = this.packetManager.client;
const data = packet.d;
client.manager.ping();
client.ws.heartbeat();
const clientUser = new ClientUser(client, data.user);
client.user = clientUser;