mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
Emit the close event on disconnect
This commit is contained in:
parent
2390e525ef
commit
b518437f52
1 changed files with 2 additions and 1 deletions
|
|
@ -219,8 +219,9 @@ class WebSocketManager extends EventEmitter {
|
||||||
/**
|
/**
|
||||||
* Emitted whenever the client websocket is disconnected
|
* Emitted whenever the client websocket is disconnected
|
||||||
* @event Client#disconnect
|
* @event Client#disconnect
|
||||||
|
* @param {CloseEvent} event The WebSocket close event
|
||||||
*/
|
*/
|
||||||
if (!this.reconnecting) this.client.emit(Constants.Events.DISCONNECT);
|
if (!this.reconnecting) this.client.emit(Constants.Events.DISCONNECT, event);
|
||||||
if (event.code === 4004) return;
|
if (event.code === 4004) return;
|
||||||
if (event.code === 4010) return;
|
if (event.code === 4010) return;
|
||||||
if (!this.reconnecting && event.code !== 1000) this.tryReconnect();
|
if (!this.reconnecting && event.code !== 1000) this.tryReconnect();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue