Use wss in test page when connected with https
This commit is contained in:
parent
7a7a4b7fce
commit
54efb85dc3
@ -55,7 +55,8 @@ fn index() -> Html<&'static str> {
|
||||
sendForm.hidden = false;
|
||||
msgsArea.hidden = false;
|
||||
msgInput.focus();
|
||||
ws = new WebSocket("ws://" + window.location.host + "/api/ws");
|
||||
let protocol = window.location.protocol == "https:" ? "wss://" : "ws://";
|
||||
ws = new WebSocket(protocol + window.location.host + "/api/ws");
|
||||
ws.onmessage = function(event) {
|
||||
msgsArea.value += event.data + "\r\n";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user