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 <noreply@anthropic.com>
This commit is contained in:
Adrian Flores Cortes 2026-01-27 05:50:35 -06:00
parent d07b888dc9
commit 190decd498

View File

@ -127,17 +127,21 @@ export class WebSocketService {
// Pre-configured WebSocket instances // Pre-configured WebSocket instances
// ============================================================================ // ============================================================================
const WS_BASE_URL = import.meta.env.VITE_WS_URL || 'ws://localhost:3000'; // Backend WebSocket (Express.js) - port 3080
const ML_WS_URL = import.meta.env.VITE_ML_WS_URL || 'ws://localhost:8001'; 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 // Trading WebSocket - for market data and order updates
// Backend uses single /ws path with message types for differentiation
export const tradingWS = new WebSocketService({ export const tradingWS = new WebSocketService({
url: `${WS_BASE_URL}/ws/trading`, url: `${WS_BASE_URL}/ws`,
reconnectInterval: 3000, reconnectInterval: 3000,
maxReconnectAttempts: 20, maxReconnectAttempts: 20,
}); });
// ML Signals WebSocket - for real-time ML predictions // ML Signals WebSocket - for real-time ML predictions
// ML Engine (FastAPI) has dedicated /ws/signals endpoint
export const mlSignalsWS = new WebSocketService({ export const mlSignalsWS = new WebSocketService({
url: `${ML_WS_URL}/ws/signals`, url: `${ML_WS_URL}/ws/signals`,
reconnectInterval: 5000, reconnectInterval: 5000,
@ -145,8 +149,9 @@ export const mlSignalsWS = new WebSocketService({
}); });
// Portfolio WebSocket - for real-time portfolio updates // Portfolio WebSocket - for real-time portfolio updates
// Uses same backend WebSocket with portfolio: prefixed message types
export const portfolioWS = new WebSocketService({ export const portfolioWS = new WebSocketService({
url: `${WS_BASE_URL}/ws/portfolio`, url: `${WS_BASE_URL}/ws`,
reconnectInterval: 5000, reconnectInterval: 5000,
maxReconnectAttempts: 15, maxReconnectAttempts: 15,
}); });