move raw call so that any cache events happen before (#1653)

* move raw call so that any cache events happen before

* Update WebSocketConnection.js

* Update WebSocketConnection.js
This commit is contained in:
Gus Caplan
2017-07-03 17:10:28 -05:00
committed by Crawl
parent afcf43aef6
commit 2eb3720001

View File

@@ -290,7 +290,9 @@ class WebSocketConnection extends EventEmitter {
} catch (err) {
this.emit('debug', err);
}
return this.onPacket(data);
const ret = this.onPacket(data);
this.client.emit('raw', data);
return ret;
}
/**
@@ -311,7 +313,6 @@ class WebSocketConnection extends EventEmitter {
this.debug('Received null packet');
return false;
}
this.client.emit('raw', packet);
switch (packet.op) {
case Constants.OPCodes.HELLO:
return this.heartbeat(packet.d.heartbeat_interval);