mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Undeprecate uws and fix support for it
This commit is contained in:
@@ -14,12 +14,10 @@ const erlpack = (function findErlpack() {
|
||||
}
|
||||
}());
|
||||
|
||||
const getUWS = util.deprecate(() => require('uws'), 'uws will soon no longer be supported, use ws instead');
|
||||
|
||||
const WebSocket = (function findWebSocket() {
|
||||
if (browser) return window.WebSocket; // eslint-disable-line no-undef
|
||||
try {
|
||||
return getUWS();
|
||||
return require('uws');
|
||||
} catch (e) {
|
||||
return require('ws');
|
||||
}
|
||||
@@ -346,6 +344,7 @@ class WebSocketConnection extends EventEmitter {
|
||||
*/
|
||||
onError(error) {
|
||||
this.client.emit(Constants.Events.ERROR, error);
|
||||
if (error.message === 'uWs client connection error') this.reconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,8 +19,8 @@ client.on('ready', () => {
|
||||
|
||||
client.on('debug', console.log);
|
||||
|
||||
client.on('error', m => console.log('debug', m));
|
||||
client.on('reconnecting', m => console.log('debug', m));
|
||||
client.on('error', m => console.log('debug', new Error(m).stack));
|
||||
client.on('reconnecting', m => console.log('reconnecting', m));
|
||||
|
||||
client.on('message', message => {
|
||||
if (true) {
|
||||
|
||||
Reference in New Issue
Block a user