01_FHEMWEB.pm: enable more precise JavaScript client notification (Forum #43945)
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9867 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -2409,8 +2409,10 @@ FW_Notify($$)
|
|||||||
|
|
||||||
if($dn eq $ntfy->{SNAME} &&
|
if($dn eq $ntfy->{SNAME} &&
|
||||||
$dev->{CHANGED} &&
|
$dev->{CHANGED} &&
|
||||||
$dev->{CHANGED}->[0] =~ m/^JS:(.*)$/) {
|
$dev->{CHANGED}->[0] =~ m/^JS(#([^:]*))?:(.*)$/) {
|
||||||
my $data = FW_longpollInfo($h->{fmt}, "#FHEMWEB:$ntfy->{NAME}",$1,"");
|
my $data = $3;
|
||||||
|
return if( $2 && $ntfy->{PEER} !~ m/$2/ );
|
||||||
|
$data = FW_longpollInfo($h->{fmt}, "#FHEMWEB:$ntfy->{NAME}",$data,"");
|
||||||
addToWritebuffer($ntfy, $data."\n");
|
addToWritebuffer($ntfy, $data."\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ TcpServer_Accept($$)
|
|||||||
my %nhash;
|
my %nhash;
|
||||||
$nhash{NR} = $devcount++;
|
$nhash{NR} = $devcount++;
|
||||||
$nhash{NAME} = $cname;
|
$nhash{NAME} = $cname;
|
||||||
|
$nhash{PEER} = $caddr;
|
||||||
|
$nhash{PORT} = $port;
|
||||||
$nhash{FD} = $clientinfo[0]->fileno();
|
$nhash{FD} = $clientinfo[0]->fileno();
|
||||||
$nhash{CD} = $clientinfo[0]; # sysread / close won't work on fileno
|
$nhash{CD} = $clientinfo[0]; # sysread / close won't work on fileno
|
||||||
$nhash{TYPE} = $type;
|
$nhash{TYPE} = $type;
|
||||||
|
|||||||
Reference in New Issue
Block a user