From 3fabcaac07c7f7382bf8a496a80deaf4c2deb662 Mon Sep 17 00:00:00 2001 From: Matteo Rosati Date: Tue, 20 Jan 2026 11:09:36 +0100 Subject: [PATCH] fix ws url --- static/js/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/main.js b/static/js/main.js index 51a80ef..1f65f10 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,6 +1,8 @@ (($) => { + const isSecure = location.protocol === "https:"; + const port = location.port ? `:${location.port}` : ""; var ws = new WebSocket( - `ws://${location.protocol + "//" + location.host}${location.port ? ":" + location.port : ""}/ws`, + `ws${isSecure ? "s" : ""}://${location.host}${port}/ws`, ); const input = $("#message"); const messages = $("#messages");