2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

01_FHEMWEB.pm: implement websocket close (Forum #76983)

git-svn-id: https://svn.fhem.de/fhem/trunk@18326 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-01-18 22:09:42 +00:00
parent b104331fa2
commit 8fbcd7a92d
2 changed files with 10 additions and 1 deletions

View File

@ -363,6 +363,11 @@ FW_Read($$)
my $len = (ord(substr($hash->{BUF},1,1)) & 0x7F);
my $i = 2;
if($op == 8) {
TcpServer_Close($hash, 1);
return;
}
if( $len == 126 ) {
$len = unpack( 'n', substr($hash->{BUF},$i,2) );
$i += 2;

View File

@ -84,8 +84,12 @@ consFill()
var loc = (""+location).replace(/\?.*/,"");
if($("body").attr("longpoll") == "websocket") {
if(consConn)
if(consConn) {
consConn.onclose =
consConn.onerror =
consConn.onmessage = undefined;
consConn.close();
}
consConn = new WebSocket(loc.replace(/[&?].*/,'')
.replace(/^http/i, "ws")+query);
consConn.onclose =