2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 16:46:35 +00:00

console.js: websocket close fix

git-svn-id: https://svn.fhem.de/fhem/trunk@13567 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-01 17:08:25 +00:00
parent 1d8585c1fa
commit 4adfa806fd

View File

@ -7,6 +7,18 @@ var mustScroll = 1;
log("Console is opening");
function
cons_closeConn()
{
if(!consConn)
return;
if(typeof consConn.close == "function")
consConn.close();
else if(typeof consConn.abort == "function")
consConn.abort();
consConn = undefined;
}
function
consUpdate(evt)
{
@ -16,8 +28,7 @@ consUpdate(evt)
if(typeof WebSocket == "function" && evt && evt.target instanceof WebSocket) {
if(evt.type == 'close') {
FW_errmsg(errstr, 4900);
consConn.close();
consConn = undefined;
cons_closeConn();
setTimeout(consFill, 5000);
return;
}
@ -58,16 +69,8 @@ consFill()
{
FW_errmsg("");
if(FW_pollConn) {
if($("body").attr("longpoll") == "websocket") {
FW_pollConn.onclose = undefined;
FW_pollConn.close();
} else {
FW_pollConn.onreadystatechange = undefined;
FW_pollConn.abort();
}
FW_pollConn = undefined;
}
if(FW_pollConn)
FW_closeConn();
var query = "?XHR=1"+
"&inform=type=raw;withLog="+withLog+";filter="+consFilter+