diff --git a/html/eee.js b/html/eee.js index 0bb89b1..cb40329 100644 --- a/html/eee.js +++ b/html/eee.js @@ -39,10 +39,11 @@ function getEEE() { } }; xhttp.open("GET", "/eee.json", true); - xhttp.send(); + xhttp.timeout = 1500; xhttp.send(); } window.addEventListener("load", function() { - const iCount = setInterval(getEEE, 1000); + getEEE(); + const iCount = setInterval(getEEE, 2000); }); -const stat = setInterval(createEEE, 500); +const stat = setInterval(createEEE, 1000); diff --git a/html/main.js b/html/main.js index be073ba..27a8587 100644 --- a/html/main.js +++ b/html/main.js @@ -51,10 +51,10 @@ function update() { } }; xhttp.open("GET", "/status.json", true); - xhttp.send(); + xhttp.timeout = 5000; xhttp.send(); } window.addEventListener("load", function() { update(); - const interval = setInterval(update, 1000); + const interval = setInterval(update, 2000); }); diff --git a/html/stat.js b/html/stat.js index 8553093..da674b7 100644 --- a/html/stat.js +++ b/html/stat.js @@ -23,21 +23,4 @@ function fillStats() { } } -function getCounts() { - for (let port = 1; port <= numPorts; port++) { - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - const s = JSON.parse(xhttp.responseText); - console.log("Counters: ", JSON.stringify(s)); - } - } - xhttp.open("GET", `/counters.json?port=${port}`, true); - xhttp.send(); - } -} - -window.addEventListener("load", function() { - const iCount = setInterval(getCounts, 1000); -}); -const stat = setInterval(fillStats, 500); +const stat = setInterval(fillStats, 1000);