mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
websocket cleanup (#1346)
* websocket cleanup * resume event * Update Resumed.js * Update WebSocketManager.js
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const Constants = require('../util/Constants');
|
||||
const WebSocketConnection = require('./websocket/WebSocketConnection');
|
||||
|
||||
/**
|
||||
* Manages the State and Background Tasks of the Client
|
||||
@@ -29,7 +30,9 @@ class ClientManager {
|
||||
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
|
||||
this.client.token = token;
|
||||
const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300);
|
||||
this.client.rest.methods.getGateway().then(gateway => {
|
||||
this.client.rest.methods.getGateway().then(res => {
|
||||
const protocolVersion = Constants.DefaultOptions.ws.version;
|
||||
const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`;
|
||||
this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);
|
||||
this.client.ws.connect(gateway);
|
||||
this.client.ws.once('close', event => {
|
||||
|
||||
Reference in New Issue
Block a user