diff --git a/js/utils/WebSocketManager.js b/js/utils/WebSocketManager.js index d0b8e26..9fbb205 100644 --- a/js/utils/WebSocketManager.js +++ b/js/utils/WebSocketManager.js @@ -140,5 +140,7 @@ class WebSocketManager { } } } -const wsUrl = `ws://${window.location.host}/layerforge/canvas_ws`; + +const protocol = location.protocol === "https:" ? "wss:" : "ws:"; +const wsUrl = `${protocol}//${location.host}/layerforge/canvas_ws`; export const webSocketManager = new WebSocketManager(wsUrl);