feature: public raw events (#3159)

* add a public alternative to the private raw event

while retaining raw for use in debugging privately

* only emit dispatch packets

* requested changes

TIL, that's neat

* fix padding

* requested changes

* Update WebSocketManager.js
This commit is contained in:
bdistin
2019-04-29 11:37:57 -05:00
committed by Amish Shah
parent 870528ed33
commit 9b0f4b298d
3 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
'use strict';
const EventEmitter = require('events');
const { Error: DJSError } = require('../../errors');
const Collection = require('../../util/Collection');
const Util = require('../../util/Util');
@@ -21,9 +22,14 @@ const UNRECOVERABLE_CLOSE_CODES = [4004, 4010, 4011];
/**
* The WebSocket manager for this client.
* <info>This class forwards raw dispatch events,
* read more about it here {@link https://discordapp.com/developers/docs/topics/gateway}</info>
* @extends EventEmitter
*/
class WebSocketManager {
class WebSocketManager extends EventEmitter {
constructor(client) {
super();
/**
* The client that instantiated this WebSocketManager
* @type {Client}