Handle websocket race condition
This commit is contained in:
parent
580c993071
commit
b6ab01d56a
1 changed files with 5 additions and 0 deletions
|
|
@ -188,6 +188,11 @@ export class WebSocketManager {
|
||||||
this.webSocket = new this.webSocketFactoryImplementation(wsUri);
|
this.webSocket = new this.webSocketFactoryImplementation(wsUri);
|
||||||
|
|
||||||
this.webSocket.onopen = (): void => {
|
this.webSocket.onopen = (): void => {
|
||||||
|
// Check if we've been stopped while connecting
|
||||||
|
if (this.isStopped) {
|
||||||
|
this.webSocket?.close(1000, "WebSocketManager was stopped during connection");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.logger.info("WebSocket connection opened");
|
this.logger.info("WebSocket connection opened");
|
||||||
this.onWebSocketStatusChanged.trigger(true);
|
this.onWebSocketStatusChanged.trigger(true);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue