Fix protocol versions

This commit is contained in:
Amish Shah
2016-08-13 16:23:24 +01:00
parent c02d7808c1
commit a2f8680514
3 changed files with 10 additions and 5 deletions

View File

@@ -16,7 +16,6 @@ class WebSocketManager {
connect(gateway) {
this.status = Constants.Status.CONNECTING;
this.store.gateway = `${gateway}/?v=${this.client.options.protocol_version}`;
this.ws = new WebSocket(gateway);
this.ws.onopen = () => this.eventOpen();
this.ws.onclose = () => this.eventClose();
@@ -81,10 +80,14 @@ class WebSocketManager {
return this.eventError(Constants.Errors.BAD_WS_MESSAGE);
}
if (packet.op === 10) {
this.client.manager.setupKeepAlive(packet.d.heartbeat_interval);
}
return this.packetManager.handle(packet);
}
EventError() {
eventError() {
this.tryReconnect();
}
@@ -108,7 +111,7 @@ class WebSocketManager {
this.ws.close();
this.packetManager.handleQueue();
this.client.emit(Constants.Events.RECONNECTING);
this.connect(this.store.gateway);
this.connect(this.client.store.gateway);
}
}