Fix connecting to websocket with SSL
Request a secure web socket (wss://) when connecting to the site with https. Fixes #61.
This commit is contained in:
parent
ad2579d59a
commit
332dfdc9cf
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue