master
km0 3 years ago
parent 3400b036bd
commit 467dcafbb0

@ -18,7 +18,11 @@
).innerHTML += `<span style="color: ${color}">${text}</span><br>`;
};
const socket = new WebSocket("wss://" + location.host + "/echo/");
const socket = new WebSocket(
location.protocol == "https"
? "wss://"
: "ws://" + location.host + location.pathname + "/echo/"
);
socket.addEventListener("message", (ev) => {
log("<<< " + ev.data, "blue");
});

Loading…
Cancel
Save