diff --git a/src/app/openlp-websocket.ts b/src/app/openlp-websocket.ts index fe83343..1f0b988 100644 --- a/src/app/openlp-websocket.ts +++ b/src/app/openlp-websocket.ts @@ -7,7 +7,8 @@ export function createWebSocket( endpoint = '' ): Observable { return new Observable((observer) => { - const ws = new WebSocket(`ws://${host}:${wsPort}/${endpoint}`); + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + const ws = new WebSocket(`${protocol}://${host}:${wsPort}/${endpoint}`); ws.onmessage = (e) => { const reader = new FileReader(); reader.onload = () => {