add auth session change handling (#1339)

* add auth session change handling

* eek
This commit is contained in:
Gus Caplan
2017-04-05 14:52:55 -05:00
committed by Crawl
parent 4ebf4307e8
commit 5d85de0883
2 changed files with 13 additions and 0 deletions

View File

@@ -71,6 +71,16 @@ class WebSocketPacketManager {
}
handle(packet) {
if (packet.t === Constants.WSEvents.AUTH_SESSION_CHANGE) {
if (packet.d.new_token) {
this.client.token = packet.d.new_token;
this.ws._sendResume();
} else {
this.client.destroy();
return false;
}
}
if (packet.op === Constants.OPCodes.RECONNECT) {
this.setSequence(packet.s);
this.ws.tryReconnect();