From 6e3540317ecdede73b0f180c4eb9753dbcb75652 Mon Sep 17 00:00:00 2001 From: Andrew Cooks Date: Fri, 19 Jun 2026 15:01:35 +1000 Subject: [PATCH] fix(client): use wss:// when the page is served over HTTPS The WebSocket URI scheme was hardcoded to ws://, so loading the client over HTTPS triggered a mixed-content error and the browser blocked the live-data connection (it never opened). Derive the scheme from location.protocol (wss:// on HTTPS, ws:// otherwise) and only append a port when one is present, so it also works behind a TLS-terminating reverse proxy on the default port 443. Co-Authored-By: Claude Opus 4.8 (1M context) --- html5-client/src/js/jittertrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html5-client/src/js/jittertrap.js b/html5-client/src/js/jittertrap.js index 9ed5618..37666cd 100644 --- a/html5-client/src/js/jittertrap.js +++ b/html5-client/src/js/jittertrap.js @@ -14,7 +14,7 @@ $(document).ready(function() { $("#chopts_chartPeriod").val(JT.charts.getChartPeriod()); // Initialize WebSockets - const wsUri = "ws://" + document.domain + ":" + location.port; + const wsUri = (location.protocol === "https:" ? "wss://" : "ws://") + document.domain + (location.port ? ":" + location.port : ""); JT.ws.init(wsUri); // Initialise charts and start render loop