diff --git a/frontend/src/services/chatWs.js b/frontend/src/services/chatWs.js index 6dac49a..344ca5d 100644 --- a/frontend/src/services/chatWs.js +++ b/frontend/src/services/chatWs.js @@ -20,8 +20,8 @@ export function getChatWsUrl() { if (host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '[::1]') { return `${proto}://127.0.0.1:1235`; } - // Default to same origin with socket.io path for production - const defaultUrl = `${proto}://${host}${port}/socket.io/`; + // Default to same origin with chat port for production + const defaultUrl = `${proto}://${host}:1235`; return defaultUrl; } @@ -50,12 +50,12 @@ export function getChatWsCandidates() { candidates.push(`${base}/`); } } - // Same-origin root and common WS paths - const sameOriginBases = [`${proto}://${host}${port}`]; - // If localhost-ish, also try 127.0.0.1 for same-origin port - if ((host === 'localhost' || host === '::1' || host === '[::1]') && port) { - sameOriginBases.push(`${proto}://[::1]${port}`); - sameOriginBases.push(`${proto}://127.0.0.1${port}`); + // Same-origin with chat port + const sameOriginBases = [`${proto}://${host}:1235`]; + // If localhost-ish, also try 127.0.0.1 for chat port + if (host === 'localhost' || host === '::1' || host === '[::1]') { + sameOriginBases.push(`${proto}://[::1]:1235`); + sameOriginBases.push(`${proto}://127.0.0.1:1235`); } for (const base of sameOriginBases) { candidates.push(base);