From e781c6b04a8d54323f6b589b56812682b04e581a Mon Sep 17 00:00:00 2001 From: James Magahern Date: Sat, 22 Feb 2025 01:27:08 -0800 Subject: [PATCH] player: websockets ssl --- frontend/src/api/player.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/player.tsx b/frontend/src/api/player.tsx index 0c06871..b8186c7 100644 --- a/frontend/src/api/player.tsx +++ b/frontend/src/api/player.tsx @@ -109,7 +109,8 @@ export const API = { }, subscribeToEvents(onMessage: (event: any) => void): WebSocket { - const ws = new WebSocket(`ws://${window.location.host}/api/events`); + const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'; + const ws = new WebSocket(`${protocol}://${window.location.host}/api/events`); ws.onmessage = (event) => { onMessage(JSON.parse(event.data)); };