mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-28 15:04:51 +00:00
fhemweb.js: no reconnect message on iOS (Forum #64313)
git-svn-id: https://svn.fhem.de/fhem/trunk@13002 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c348cac811
commit
ccec0cad6a
@ -672,19 +672,29 @@ FW_rawDef()
|
|||||||
var FW_pollConn;
|
var FW_pollConn;
|
||||||
var FW_longpollOffset = 0;
|
var FW_longpollOffset = 0;
|
||||||
var FW_leaving;
|
var FW_leaving;
|
||||||
|
var FW_lastDataTime=0;
|
||||||
|
|
||||||
function
|
function
|
||||||
FW_doUpdate(evt)
|
FW_doUpdate(evt)
|
||||||
{
|
{
|
||||||
var errstr = "Connection lost, trying a reconnect every 5 seconds.";
|
var errstr = "Connection lost, trying a reconnect every 5 seconds.";
|
||||||
var input="";
|
var input="";
|
||||||
|
var retryTime = 5000;
|
||||||
|
var now = new Date()/1000;
|
||||||
|
|
||||||
|
// iOS closes HTTP after 60s idle, websocket after 240s idle
|
||||||
|
if(now-FW_lastDataTime > 59) {
|
||||||
|
errstr="";
|
||||||
|
retryTime = 100;
|
||||||
|
}
|
||||||
|
FW_lastDataTime = now;
|
||||||
|
|
||||||
if(evt.target instanceof WebSocket) {
|
if(evt.target instanceof WebSocket) {
|
||||||
if(evt.type == 'close' && !FW_leaving) {
|
if(evt.type == 'close' && !FW_leaving) {
|
||||||
FW_errmsg(errstr, 4900);
|
FW_errmsg(errstr, retryTime-100);
|
||||||
FW_pollConn.close();
|
FW_pollConn.close();
|
||||||
FW_pollConn = undefined;
|
FW_pollConn = undefined;
|
||||||
setTimeout(FW_longpoll, 5000);
|
setTimeout(FW_longpoll, retryTime);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input = evt.data;
|
input = evt.data;
|
||||||
@ -696,8 +706,8 @@ FW_doUpdate(evt)
|
|||||||
location.reload();
|
location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FW_errmsg(errstr, 4900);
|
FW_errmsg(errstr, retryTime-100);
|
||||||
setTimeout(FW_longpoll, 5000);
|
setTimeout(FW_longpoll, retryTime);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1411,8 +1421,8 @@ loadScript(sname, callback, force)
|
|||||||
}
|
}
|
||||||
script.onload = function(){
|
script.onload = function(){
|
||||||
scriptLoaded();
|
scriptLoaded();
|
||||||
if(FW_isiOS)
|
// if(FW_isiOS) // Fixed in the maintime/not needed with 10.2
|
||||||
FW_longpoll();
|
// FW_longpoll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.appendChild(script);
|
h.appendChild(script);
|
||||||
@ -1456,3 +1466,10 @@ scriptAttribute(sname)
|
|||||||
return ua;
|
return ua;
|
||||||
}
|
}
|
||||||
/*************** SCRIPT LOAD FUNCTIONS END **************/
|
/*************** SCRIPT LOAD FUNCTIONS END **************/
|
||||||
|
|
||||||
|
function print_call_stack() {
|
||||||
|
var stack = new Error().stack;
|
||||||
|
console.log("PRINTING CALL STACK");
|
||||||
|
console.log( stack );
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user