From dfe37821770c2ed8c97ab6642708a46fb00e00a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:10:18 +0000 Subject: [PATCH] Improve server-side environment detection for WebSocket URL Co-authored-by: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> --- app/composables/useWebSocketUrl.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/composables/useWebSocketUrl.ts b/app/composables/useWebSocketUrl.ts index c2d28f4..6ad6558 100644 --- a/app/composables/useWebSocketUrl.ts +++ b/app/composables/useWebSocketUrl.ts @@ -8,6 +8,14 @@ export const useWebSocketUrl = () => { return `${protocol}//${host}/ws/signaling` } - // Server-side: default to localhost for development - return 'ws://localhost:3000/ws/signaling' + // Server-side: This shouldn't be used since WebSocket connections are client-only + // But we provide a sensible default for SSR hydration + const config = useRuntimeConfig() + const isDev = process.dev + + if (isDev) { + return 'ws://localhost:3000/ws/signaling' + } + + return 'wss://helium.srizan.dev/ws/signaling' }