diff --git a/handlers.go b/handlers.go index 40bb39b..9099f14 100644 --- a/handlers.go +++ b/handlers.go @@ -68,6 +68,7 @@ func wsWasmFile(w http.ResponseWriter, r *http.Request) { if settings.NoCache { w.Header().Set("Cache-Control", "no-cache, must-revalidate") } + common.LogDebugln("[static] serving wasm file") http.ServeFile(w, r, "./static/main.wasm") } diff --git a/static/js/chat.js b/static/js/chat.js index 398bd26..ebe70ec 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -59,7 +59,11 @@ function getWsUri() { if (port != "") { port = ":" + port; } - return "ws://" + window.location.hostname + port + "/ws"; + proto = "ws://" + if (location.protocol == "https:") { + proto = "wss://" + } + return proto + window.location.hostname + port + "/ws"; } let maxMessageCount = 0