From 8f996c03d38007d74e84c737485aa3723239e4cf Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Sun, 29 Mar 2020 19:50:06 +0200 Subject: [PATCH] make websockets use wss if https --- backend/templates/debug.html.tera | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/templates/debug.html.tera b/backend/templates/debug.html.tera index 389cbfa..9e96d2c 100644 --- a/backend/templates/debug.html.tera +++ b/backend/templates/debug.html.tera @@ -91,7 +91,8 @@ const network = new vis.Network(container, data, options); - var ws = new WebSocket(`ws://${window.location.hostname}:3012`); + + var ws = new WebSocket(`${window.location.protocol.startsWith("https") ? 'wss' : 'ws'}://${window.location.hostname}:3012`); ws.onmessage = function (event) { handle_event(JSON.parse(event.data)); };