fix: emit resume event, silent disconnects, error event param (#3192)

* src: Fix shardResumed event not being emitted

* docs: Document Client#error again

* src: Fix onError due to incorrect typings

* src: handle onError properly for both uws and ws

* src: Try to fix silent disconnects when using uWs

* fix(WebSocketShard): uws emits plain objects, not errors

Emitting line of code: 39aa429f94/src/uws.js (L80-L83)
Listener attaching is here: https://github.com/discordjs/uws/blob/master/src/uws.js#L128
For reference, found a clue here: https://github.com/discordjs/discord.js/issues/1528
This commit is contained in:
Vlad Frangu
2019-04-21 10:32:16 +03:00
committed by SpaceEEC
parent cde955c766
commit 1514df0f87
5 changed files with 24 additions and 20 deletions

View File

@@ -194,15 +194,6 @@ class WebSocketManager {
if (!this.shardQueue.size) this.reconnecting = false;
});
shard.on(ShardEvents.RESUMED, () => {
/**
* Emitted when a shard resumes successfully.
* @event Client#shardResumed
* @param {number} id The shard ID that resumed
*/
this.client.emit(Events.SHARD_RESUMED, shard.id);
});
shard.on(ShardEvents.CLOSE, event => {
if (event.code === 1000 ? this.destroyed : UNRECOVERABLE_CLOSE_CODES.includes(event.code)) {
/**