mirror of
https://github.com/danbulant/discord.js
synced 2026-06-18 14:11:09 +00:00
Undeprecate uws and fix support for it
This commit is contained in:
parent
f20f49388d
commit
edf1a3e7b4
2 changed files with 4 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue