From 190decd49818530e329f6b33a701f78f67cad681 Mon Sep 17 00:00:00 2001 From: Adrian Flores Cortes Date: Tue, 27 Jan 2026 05:50:35 -0600 Subject: [PATCH] fix(frontend): correct WebSocket URLs and ports - Backend WS: Changed from localhost:3000/ws/trading to localhost:3080/ws - ML Engine WS: Changed from localhost:8001 to localhost:3083 - Portfolio WS: Changed from localhost:3000/ws/portfolio to localhost:3080/ws - Backend uses single /ws path with message types for channel differentiation - ML Engine has dedicated /ws/signals endpoint Co-Authored-By: Claude Opus 4.5 --- src/services/websocket.service.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/services/websocket.service.ts b/src/services/websocket.service.ts index 8bda02a..4764fe4 100644 --- a/src/services/websocket.service.ts +++ b/src/services/websocket.service.ts @@ -127,17 +127,21 @@ export class WebSocketService { // Pre-configured WebSocket instances // ============================================================================ -const WS_BASE_URL = import.meta.env.VITE_WS_URL || 'ws://localhost:3000'; -const ML_WS_URL = import.meta.env.VITE_ML_WS_URL || 'ws://localhost:8001'; +// Backend WebSocket (Express.js) - port 3080 +const WS_BASE_URL = import.meta.env.VITE_WS_URL || 'ws://localhost:3080'; +// ML Engine WebSocket (FastAPI) - port 3083 +const ML_WS_URL = import.meta.env.VITE_ML_WS_URL || 'ws://localhost:3083'; // Trading WebSocket - for market data and order updates +// Backend uses single /ws path with message types for differentiation export const tradingWS = new WebSocketService({ - url: `${WS_BASE_URL}/ws/trading`, + url: `${WS_BASE_URL}/ws`, reconnectInterval: 3000, maxReconnectAttempts: 20, }); // ML Signals WebSocket - for real-time ML predictions +// ML Engine (FastAPI) has dedicated /ws/signals endpoint export const mlSignalsWS = new WebSocketService({ url: `${ML_WS_URL}/ws/signals`, reconnectInterval: 5000, @@ -145,8 +149,9 @@ export const mlSignalsWS = new WebSocketService({ }); // Portfolio WebSocket - for real-time portfolio updates +// Uses same backend WebSocket with portfolio: prefixed message types export const portfolioWS = new WebSocketService({ - url: `${WS_BASE_URL}/ws/portfolio`, + url: `${WS_BASE_URL}/ws`, reconnectInterval: 5000, maxReconnectAttempts: 15, });