mirror of
https://github.com/danbulant/discord.js
synced 2026-06-24 17:21:59 +00:00
Webpack build for branch master: 51a2e465bd
This commit is contained in:
parent
6909d125b3
commit
2ef45cb24e
2 changed files with 11 additions and 2 deletions
|
|
@ -17136,6 +17136,12 @@ class WebSocketConnection extends EventEmitter {
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.closeSequence = 0;
|
this.closeSequence = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the WebSocket is expecting to be closed
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.expectingClose = false;
|
||||||
for (const event of this.client.options.disabledEvents) this.disabledEvents[event] = true;
|
for (const event of this.client.options.disabledEvents) this.disabledEvents[event] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17275,6 +17281,7 @@ class WebSocketConnection extends EventEmitter {
|
||||||
this.debug(`Tried to connect to an invalid gateway: ${gateway}`);
|
this.debug(`Tried to connect to an invalid gateway: ${gateway}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.expectingClose = false;
|
||||||
this.gateway = gateway;
|
this.gateway = gateway;
|
||||||
this.debug(`Connecting to ${gateway}`);
|
this.debug(`Connecting to ${gateway}`);
|
||||||
const ws = this.ws = new WebSocket(gateway);
|
const ws = this.ws = new WebSocket(gateway);
|
||||||
|
|
@ -17298,6 +17305,7 @@ class WebSocketConnection extends EventEmitter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.heartbeat(-1);
|
this.heartbeat(-1);
|
||||||
|
this.expectingClose = true;
|
||||||
ws.close(1000);
|
ws.close(1000);
|
||||||
this.packetManager.handleQueue();
|
this.packetManager.handleQueue();
|
||||||
this.ws = null;
|
this.ws = null;
|
||||||
|
|
@ -17399,7 +17407,8 @@ class WebSocketConnection extends EventEmitter {
|
||||||
* @param {CloseEvent} event Close event that was received
|
* @param {CloseEvent} event Close event that was received
|
||||||
*/
|
*/
|
||||||
onClose(event) {
|
onClose(event) {
|
||||||
this.debug(`Closed: ${event.code}`);
|
this.debug(`${this.expectingClose ? 'Server' : 'Client'} closed WebSocket connection: ${event.code}`);
|
||||||
|
this.expectingClose = false;
|
||||||
this.closeSequence = this.sequence;
|
this.closeSequence = this.sequence;
|
||||||
// Reset the state before trying to fix anything
|
// Reset the state before trying to fix anything
|
||||||
this.emit('close', event);
|
this.emit('close', event);
|
||||||
|
|
|
||||||
2
discord.master.min.js
vendored
2
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue