1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 06:10:18 +00:00

Connect to correct websocket on different port

This commit is contained in:
2020-01-27 13:13:47 +01:00
parent 22f6b3922e
commit 3afd518399
3 changed files with 20 additions and 8 deletions

12
data/js/controls.js vendored
View File

@ -198,7 +198,17 @@ function handleVisibilityChange() {
function start() {
document.addEventListener("visibilitychange", handleVisibilityChange, false);
websock = new WebSocket("ws://" + window.location.hostname + "/ws");
if (
window.location.port != "" ||
window.location.port != 80 ||
window.location.port != 443
) {
websock = new WebSocket(
"ws://" + window.location.hostname + ":" + window.location.port + "/ws"
);
} else {
websock = new WebSocket("ws://" + window.location.hostname + "/ws");
}
websock.onopen = function(evt) {
console.log("websock open");
$("#conStatus").addClass("color-green");