From fe012f2b82acbb3136cd32a439509ce416e90c10 Mon Sep 17 00:00:00 2001 From: ok-home Date: Wed, 27 Sep 2023 21:10:39 +0700 Subject: [PATCH] html restsrt debug --- source/ota_ws_update.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/ota_ws_update.html b/source/ota_ws_update.html index e1cf70f..1577fb2 100644 --- a/source/ota_ws_update.html +++ b/source/ota_ws_update.html @@ -151,10 +151,11 @@ 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) { @@ -246,9 +247,11 @@ socket.onopen = function () { console.log("connect ws"); }; - socket.onclose = function (event) { - //document.location.reload(); - console.log("close ws"); + socket.onclose = async function (event) { + console.log("close ws - reload"); + await sleep(2000); + document.location.reload(); + //console.log("close ws"); }; socket.onerror = function () { //document.location.reload();