|
|
@ -1958,6 +1958,7 @@ var Screen = (function () { |
|
|
|
var Conn = (function() { |
|
|
|
var Conn = (function() { |
|
|
|
var ws; |
|
|
|
var ws; |
|
|
|
var heartbeatTout; |
|
|
|
var heartbeatTout; |
|
|
|
|
|
|
|
var pingIv; |
|
|
|
|
|
|
|
|
|
|
|
function onOpen(evt) { |
|
|
|
function onOpen(evt) { |
|
|
|
console.log("CONNECTED"); |
|
|
|
console.log("CONNECTED"); |
|
|
@ -2023,12 +2024,23 @@ var Conn = (function() { |
|
|
|
|
|
|
|
|
|
|
|
function heartbeat() { |
|
|
|
function heartbeat() { |
|
|
|
clearTimeout(heartbeatTout); |
|
|
|
clearTimeout(heartbeatTout); |
|
|
|
heartbeatTout = setTimeout(heartbeatFail, 3000); |
|
|
|
heartbeatTout = setTimeout(heartbeatFail, 2000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function heartbeatFail() { |
|
|
|
function heartbeatFail() { |
|
|
|
console.error("Heartbeat lost, reloading..."); |
|
|
|
console.error("Heartbeat lost, probing server..."); |
|
|
|
location.reload(); |
|
|
|
pingIv = setInterval(function() { |
|
|
|
|
|
|
|
console.log("> ping"); |
|
|
|
|
|
|
|
$.get('http://'+_root+'/system/ping', function(resp, status) { |
|
|
|
|
|
|
|
if (status == 200) { |
|
|
|
|
|
|
|
clearInterval(pingIv); |
|
|
|
|
|
|
|
console.info("Server ready, reloading page..."); |
|
|
|
|
|
|
|
location.reload(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
timeout: 100, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|