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)); };