From ef188e1f67e528dc287ad63fb3be013783035ebc Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 10 Apr 2026 20:03:50 -0700 Subject: [PATCH] Fix managed mode WebSocket URL when server_url uses https:// MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The URL builder was prepending wss:// to the full https:// URL, producing an invalid wss://https://... URL. Now properly converts https→wss and http→ws before appending the /ws/transcribe path. Co-Authored-By: Claude Opus 4.6 (1M context) --- client/deepgram_transcription.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/deepgram_transcription.py b/client/deepgram_transcription.py index 0feeba2..8b26f9d 100644 --- a/client/deepgram_transcription.py +++ b/client/deepgram_transcription.py @@ -320,9 +320,13 @@ class DeepgramTranscriptionEngine: def _build_ws_url_and_headers(self): """Return ``(url, headers)`` depending on the current mode.""" if self.mode == "managed": - # Ensure the server URL uses wss:// and append the path + # Convert HTTP(S) URLs to WS(S) for WebSocket connection url = self.server_url.rstrip("/") - if not url.startswith("ws://") and not url.startswith("wss://"): + if url.startswith("https://"): + url = "wss://" + url[len("https://"):] + elif url.startswith("http://"): + url = "ws://" + url[len("http://"):] + elif not url.startswith("ws://") and not url.startswith("wss://"): url = f"wss://{url}" url = f"{url}/ws/transcribe" return url, {}