This commit is contained in:
ok-home
2023-09-28 08:34:13 +07:00
committed by GitHub
parent fe012f2b82
commit 6438c5c77b
3 changed files with 6 additions and 9 deletions

View File

@@ -151,11 +151,10 @@
socket.send(JSON.stringify({ name: "otaRestartEsp", value: "restart" }));
});
/* // debug -> test sample
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
/* // debug -> test sample
async function tstReceive() {
receiveWsData(JSON.stringify({ name: "otaSetChunkSize", value: 1024 }));
while (otaStartsegment + otaSetChunkSize <= otaData.length && otaStarted == 1) {
@@ -247,15 +246,13 @@
socket.onopen = function () {
console.log("connect ws");
};
socket.onclose = async function (event) {
socket.onclose = function (event) {
console.log("close ws - reload");
await sleep(2000);
document.location.reload();
//console.log("close ws");
setTimeout(() => document.location.reload(), 2000);
};
socket.onerror = function () {
//document.location.reload();
console.log("error ws");
setTimeout(() => document.location.reload(), 2000);
};
socket.onmessage = function (event) {
receiveWsData(event.data);