Handle websocket race condition

This commit is contained in:
Andras Schmelczer 2025-12-14 11:05:55 +00:00
parent 580c993071
commit b6ab01d56a

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);
};