mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
add constants, some debug stuff (#791)
* add constants, some debug stuff * i can't believe i did this
This commit is contained in:
parent
32eeb8ad5e
commit
96355a4968
4 changed files with 6 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ class ClientManager {
|
|||
*/
|
||||
setupKeepAlive(time) {
|
||||
this.heartbeatInterval = this.client.setInterval(() => {
|
||||
this.client.emit('debug', 'SENDING HEARTBEAT');
|
||||
this.client.ws.send({
|
||||
op: Constants.OPCodes.HEARTBEAT,
|
||||
d: this.client.ws.sequence,
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class WebSocketManager extends EventEmitter {
|
|||
|
||||
this.client.emit('raw', packet);
|
||||
|
||||
if (packet.op === 10) this.client.manager.setupKeepAlive(packet.d.heartbeat_interval);
|
||||
if (packet.op === Constants.OPCodes.HELLO) this.client.manager.setupKeepAlive(packet.d.heartbeat_interval);
|
||||
return this.packetManager.handle(packet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ class WebSocketPacketManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) this.ws.client.emit('debug', 'HEARTBEAT ACK');
|
||||
|
||||
if (this.ws.status === Constants.Status.RECONNECTING) {
|
||||
this.ws.reconnecting = false;
|
||||
this.ws.checkIfReady();
|
||||
|
|
|
|||
|
|
@ -140,6 +140,8 @@ exports.OPCodes = {
|
|||
RECONNECT: 7,
|
||||
REQUEST_GUILD_MEMBERS: 8,
|
||||
INVALID_SESSION: 9,
|
||||
HELLO: 10,
|
||||
HEARTBEAT_ACK: 11,
|
||||
};
|
||||
|
||||
exports.VoiceOPCodes = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue