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

@@ -257,6 +257,7 @@ class WebSocketShard extends EventEmitter {
try {
packet = WebSocket.unpack(this.inflate.result);
this.manager.client.emit(Events.RAW, packet, this.id);
if (packet.op === OPCodes.DISPATCH) this.manager.emit(packet.t, packet.d, this.id);
} catch (err) {
this.manager.client.emit(Events.SHARD_ERROR, err, this.id);
return;