Improve WebSocket fallback logic
Browse filesUse 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
|
|
|
|
|
|
|
| 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 |
|