Handle websocket race condition

This commit is contained in:
Andras Schmelczer 2025-12-14 11:05:55 +00:00
parent 19022c5b5f
commit 9c5882e5fb

View file

@ -188,6 +188,11 @@ export class WebSocketManager {
this.webSocket = new this.webSocketFactoryImplementation(wsUri);
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.onWebSocketStatusChanged.trigger(true);
};