Skip to content

Commit

Permalink
Merge pull request #749 from wazo-platform/websocket_close_exception
Browse files Browse the repository at this point in the history
Do not close websocket when already closed
  • Loading branch information
manuquentin authored Feb 28, 2024
2 parents 2bdf9cb + 0f9035b commit e93bba2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/websocket-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ class WebSocketClient extends Emitter {
return;
}

if (this.socket.readyState === 3) {
logger.warn('Trying to close an already closed websocket, bailing.', { url: this._getUrl() });
return;
}

this.socket.close();
this.initialized = false;

Expand Down

0 comments on commit e93bba2

Please sign in to comment.