CORS implemented in a static manner: unable to configure on another machine

This commit is contained in:
aodulov
2025-10-15 13:45:36 +03:00
parent ea0e025b0e
commit 03d31011fd
18 changed files with 582 additions and 16 deletions

View File

@@ -14,7 +14,8 @@ class WebSocketService {
this.currentSessionId = sessionId;
this.currentClientId = clientId;
const wsUrl = `ws://localhost:8000/sessions/${sessionId}`;
const apiUrl = process.env.REACT_APP_API_URL || 'ws://localhost:8000';
const wsUrl = `${apiUrl.replace(/^http/, 'ws')}/sessions/${sessionId}`;
this.ws = new WebSocket(wsUrl);
this.ws.onopen = () => {