Improve server-side environment detection for WebSocket URL

Co-authored-by: SrIzan10 <66965250+SrIzan10@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-30 11:10:18 +00:00
parent 8206763a41
commit dfe3782177

View File

@@ -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'
}