Use relative URL for websocket
Partially merged from branch 'schnusch-http-prefix'
This commit is contained in:
commit
130c430d3d
2 changed files with 5 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
|
@ -345,10 +345,9 @@ window.addEventListener("load", function() {
|
||||||
text.value = "";
|
text.value = "";
|
||||||
showScene(opening);
|
showScene(opening);
|
||||||
|
|
||||||
ws = new WebSocket(
|
let wsURL = new URL("ws", location.href);
|
||||||
(location.protocol == "http:" ? "ws:" : "wss:") + "//" + location.hostname +
|
wsURL.protocol = wsURL.protocol == "http:" ? "ws:" : "wss:";
|
||||||
(location.port ? ":" + location.port : "") + "/ws"
|
ws = new WebSocket(wsURL);
|
||||||
);
|
|
||||||
|
|
||||||
ws.onmessage = function(evt) {
|
ws.onmessage = function(evt) {
|
||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue