Skip to content

Commit a27ac16

Browse files
authored
Merge pull request #373 from rover0811/main
Add: support for secure WebSocket (WSS) connections
2 parents d9d8d51 + d299930 commit a27ac16

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

whisper_live/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(
3030
model="small",
3131
srt_file_path="output.srt",
3232
use_vad=True,
33+
use_wss=False,
3334
log_transcription=True,
3435
max_clients=4,
3536
max_connection_time=600,
@@ -72,6 +73,7 @@ def __init__(
7273
self.server_error = False
7374
self.srt_file_path = srt_file_path
7475
self.use_vad = use_vad
76+
self.use_wss = use_wss
7577
self.last_segment = None
7678
self.last_received_segment = None
7779
self.log_transcription = log_transcription
@@ -88,7 +90,8 @@ def __init__(
8890
self.audio_bytes = None
8991

9092
if host is not None and port is not None:
91-
socket_url = f"ws://{host}:{port}"
93+
socket_protocol = 'wss' if self.use_wss else "ws"
94+
socket_url = f"{socket_protocol}://{host}:{port}"
9295
self.client_socket = websocket.WebSocketApp(
9396
socket_url,
9497
on_open=lambda ws: self.on_open(ws),
@@ -721,6 +724,7 @@ def __init__(
721724
translate=False,
722725
model="small",
723726
use_vad=True,
727+
use_wss=False,
724728
save_output_recording=False,
725729
output_recording_filename="./output_recording.wav",
726730
output_transcription_path="./output.srt",
@@ -741,6 +745,7 @@ def __init__(
741745
model,
742746
srt_file_path=output_transcription_path,
743747
use_vad=use_vad,
748+
use_wss=use_wss,
744749
log_transcription=log_transcription,
745750
max_clients=max_clients,
746751
max_connection_time=max_connection_time,

0 commit comments

Comments
 (0)