diff --git a/app.min.js b/app.min.js index 97a12b16..1f943823 100644 --- a/app.min.js +++ b/app.min.js @@ -15018,10 +15018,17 @@ var _devices = []; var listener$7 = start$6(); var expects = []; + var timeping = 5000; + var timeout; function connect$1() { if (!window.lampa_settings.socket_use) return; clearInterval(ping); + clearTimeout(timeout); + timeout = setTimeout(function () { + console.log('Socket', 'timeout close'); + if (socket) socket.close(); + }, 10000); try { socket = new WebSocket(window.lampa_settings.socket_url); @@ -15032,13 +15039,18 @@ if (!socket) return; socket.addEventListener('open', function (event) { console.log('Socket', 'open'); + timeping = 5000; + clearTimeout(timeout); send('start', {}); listener$7.send('open', {}); }); socket.addEventListener('close', function (event) { console.log('Socket', 'close', event.code); + clearTimeout(timeout); listener$7.send('close', {}); - setTimeout(connect$1, 5000); + console.log('Socket', 'try connect after', Math.round(timeping) / 1000, 'sec.'); + setTimeout(connect$1, Math.round(timeping)); + timeping *= 2; }); socket.addEventListener('error', function (event) { console.log('Socket', 'error:', 'maybe there is no connection to the server');