qfuxa cagram commited on
Commit
ecd3f4b
·
1 Parent(s): d97eda8

Improve WebSocket fallback logic

Browse files

Use window.location.hostname and port if available,
otherwise fallback to localhost:8000.

Co-authored-by: Chris Margach <[email protected]>

whisperlivekit/web/live_transcription.html CHANGED
@@ -315,7 +315,9 @@
315
  const linesTranscriptDiv = document.getElementById("linesTranscript");
316
  const timerElement = document.querySelector(".timer");
317
 
318
- const defaultWebSocketUrl = `ws://${window.location.hostname}:${window.location.port}/asr`;
 
 
319
  websocketInput.value = defaultWebSocketUrl;
320
  websocketUrl = defaultWebSocketUrl;
321
 
 
315
  const linesTranscriptDiv = document.getElementById("linesTranscript");
316
  const timerElement = document.querySelector(".timer");
317
 
318
+ const host = window.location.hostname || "localhost";
319
+ const port = window.location.port || "8000";
320
+ const defaultWebSocketUrl = `ws://${host}:${port}/asr`;
321
  websocketInput.value = defaultWebSocketUrl;
322
  websocketUrl = defaultWebSocketUrl;
323