player: websockets ssl

This commit is contained in:
2025-02-22 01:27:08 -08:00
parent 0ec6c2e3b3
commit 656492dd97

View File

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