mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +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:
parent
1d8585c1fa
commit
4adfa806fd
@ -7,6 +7,18 @@ var mustScroll = 1;
|
|||||||
|
|
||||||
log("Console is opening");
|
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
|
function
|
||||||
consUpdate(evt)
|
consUpdate(evt)
|
||||||
{
|
{
|
||||||
@ -16,8 +28,7 @@ consUpdate(evt)
|
|||||||
if(typeof WebSocket == "function" && evt && evt.target instanceof WebSocket) {
|
if(typeof WebSocket == "function" && evt && evt.target instanceof WebSocket) {
|
||||||
if(evt.type == 'close') {
|
if(evt.type == 'close') {
|
||||||
FW_errmsg(errstr, 4900);
|
FW_errmsg(errstr, 4900);
|
||||||
consConn.close();
|
cons_closeConn();
|
||||||
consConn = undefined;
|
|
||||||
setTimeout(consFill, 5000);
|
setTimeout(consFill, 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,16 +69,8 @@ consFill()
|
|||||||
{
|
{
|
||||||
FW_errmsg("");
|
FW_errmsg("");
|
||||||
|
|
||||||
if(FW_pollConn) {
|
if(FW_pollConn)
|
||||||
if($("body").attr("longpoll") == "websocket") {
|
FW_closeConn();
|
||||||
FW_pollConn.onclose = undefined;
|
|
||||||
FW_pollConn.close();
|
|
||||||
} else {
|
|
||||||
FW_pollConn.onreadystatechange = undefined;
|
|
||||||
FW_pollConn.abort();
|
|
||||||
}
|
|
||||||
FW_pollConn = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = "?XHR=1"+
|
var query = "?XHR=1"+
|
||||||
"&inform=type=raw;withLog="+withLog+";filter="+consFilter+
|
"&inform=type=raw;withLog="+withLog+";filter="+consFilter+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user