DiscordClient: add logging for lack of heartbeat ACK

This commit is contained in:
hippoz 2022-02-16 14:03:03 +02:00
parent b9c25ec3e6
commit 7329570cb7
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -49,6 +49,7 @@ class DiscordClient extends EventEmitter {
this._heartbeatInterval = setInterval(() => { this._heartbeatInterval = setInterval(() => {
if (!this.gotServerHeartbeatACK) { if (!this.gotServerHeartbeatACK) {
logError("Closing due to no heartbeat ACK...");
this.ws.close(1000, "No heartbeat ACK."); this.ws.close(1000, "No heartbeat ACK.");
return; return;
} }
@ -227,6 +228,13 @@ class DiscordClient extends EventEmitter {
this.ws = null; this.ws = null;
} }
setTimeout(() => {
if (!this.__init) {
this.__init = true;
this.ws.close();
}
}, 6000)
const ws = new WebSocket(this.gatewayUrl); const ws = new WebSocket(this.gatewayUrl);
this.ws = ws; this.ws = ws;