mirror of
https://github.com/SrIzan10/helium.git
synced 2026-06-06 00:56:58 +00:00
Improve server-side environment detection for WebSocket URL
Co-authored-by: SrIzan10 <66965250+SrIzan10@users.noreply.github.com>
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user