From 24684d032e733c845e3870988cad5a2d4b43524f Mon Sep 17 00:00:00 2001 From: Mat Date: Sun, 20 Oct 2024 11:12:18 +0000 Subject: [PATCH] Also support WebSocket SSL --- src/app/openlp-websocket.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 = () => {