diff --git a/src/frontend/src/services/WebSocketService.tsx b/src/frontend/src/services/WebSocketService.tsx index 409e1e979..73e017f89 100644 --- a/src/frontend/src/services/WebSocketService.tsx +++ b/src/frontend/src/services/WebSocketService.tsx @@ -12,11 +12,12 @@ class WebSocketService { private planSubscriptions: Set = new Set(); private reconnectTimer: NodeJS.Timeout | null = null; private isConnecting = false; - private baseWsUrl = getApiUrl() || 'ws://localhost:8000'; + private buildSocketUrl(processId?: string, sessionId?: string): string { + const baseWsUrl = getApiUrl() || 'ws://localhost:8000'; // Trim and remove trailing slashes - let base = (this.baseWsUrl || '').trim().replace(/\/+$/, ''); + let base = (baseWsUrl || '').trim().replace(/\/+$/, ''); // Normalize protocol: http -> ws, https -> wss base = base.replace(/^http:\/\//i, 'ws://') .replace(/^https:\/\//i, 'wss://');