Skip to content

Commit

Permalink
fix(websocket): websocket.terminate() does not work in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
jurosh committed Oct 8, 2020
1 parent 1e2b332 commit 9881311
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/client/webSocket/index.ts
Expand Up @@ -464,15 +464,6 @@ export class WebSocketClient {
});
}

private destroyWebSocket(): void {
this.stopPinging();
if (this.webSocket) {
this.doNotReconnect = true;
this.webSocket.terminate();
this.webSocket = null;
}
}

private handleWebSocketConnect(): void {
this.resetReconnectionState();
this.startPinging();
Expand Down Expand Up @@ -545,7 +536,7 @@ export class WebSocketClient {
}

private reconnect(): void {
this.destroyWebSocket();
this.disconnect();
this.doNotReconnect = false;
// Reconnect with exponential backoff
const backoffSeconds = 2 ** this.reconnectAttempt;
Expand Down

0 comments on commit 9881311

Please sign in to comment.