2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 06:48:43 +00:00

01_FHEMWEB.pm: enable more precise JavaScript client notification (Forum #43945)

git-svn-id: https://svn.fhem.de/fhem/trunk@9867 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-11-12 16:41:48 +00:00
parent c439f0e78b
commit 35191cc739
2 changed files with 6 additions and 2 deletions

View File

@ -2409,8 +2409,10 @@ FW_Notify($$)
if($dn eq $ntfy->{SNAME} &&
$dev->{CHANGED} &&
$dev->{CHANGED}->[0] =~ m/^JS:(.*)$/) {
my $data = FW_longpollInfo($h->{fmt}, "#FHEMWEB:$ntfy->{NAME}",$1,"");
$dev->{CHANGED}->[0] =~ m/^JS(#([^:]*))?:(.*)$/) {
my $data = $3;
return if( $2 && $ntfy->{PEER} !~ m/$2/ );
$data = FW_longpollInfo($h->{fmt}, "#FHEMWEB:$ntfy->{NAME}",$data,"");
addToWritebuffer($ntfy, $data."\n");
return;
}

View File

@ -113,6 +113,8 @@ TcpServer_Accept($$)
my %nhash;
$nhash{NR} = $devcount++;
$nhash{NAME} = $cname;
$nhash{PEER} = $caddr;
$nhash{PORT} = $port;
$nhash{FD} = $clientinfo[0]->fileno();
$nhash{CD} = $clientinfo[0]; # sysread / close won't work on fileno
$nhash{TYPE} = $type;