2015-03-04 20:55:53 +01:00
2020-02-04 20:09:53 +01:00
< script type = "text/html" data-template-name = "discovery" >
2015-03-04 20:55:53 +01:00
< div class = "form-row" >
2015-05-08 21:57:15 +02:00
< label for = "node-input-service" > < i class = "fa fa-gear" > < / i > Service< / label >
2015-03-04 20:55:53 +01:00
< input type = "text" id = "node-input-service" placeholder = "_http._tcp" >
< / div >
< div class = "form-row" >
2015-05-08 21:57:15 +02:00
< label for = "node-input-topic" > < i class = "fa fa-tasks" > < / i > Topic< / label >
2015-03-04 20:55:53 +01:00
< input type = "text" id = "node-input-topic" placeholder = "Topic" >
< / div >
< div class = "form-row" >
2015-05-08 21:57:15 +02:00
< label for = "node-input-name" > < i class = "fa fa-tag" > < / i > Name< / label >
2015-03-04 20:55:53 +01:00
< input type = "text" id = "node-input-name" placeholder = "Name" >
< / div >
< div class = "form-tips" > The service < i > must< / i > start with an underscore _ and end ._tcp or ._udp< / div >
< / script >
2020-02-04 20:09:53 +01:00
< script type = "text/html" data-help-name = "discovery" >
2015-03-04 20:55:53 +01:00
< p > Provides a Bonjour / Avahi / Zeroconf discovery node.< / p >
2016-03-02 14:26:19 +01:00
< p > < code > msg.payload< / code > contains the service object on both arrival and leaving.< / p >
2017-11-23 21:53:44 +01:00
< p > < code > msg.payload.state< / code > contains boolean < i > true< / i > or < i > false< / i > depending
2016-01-01 15:31:55 +01:00
if the service has arrived (< i > true< / i > ) or gone away (< i > false< / i > ).< / p >
2015-03-04 20:55:53 +01:00
< p > Within the msg.payload object the most interesting things are:
< ul > < li > msg.payload.name< / li >
2016-01-01 15:31:55 +01:00
< li > msg.payload.networkInterface< / li >
< li > msg.payload.host< / li >
2015-03-04 20:55:53 +01:00
< li > msg.payload.port< / li >
2016-01-01 15:31:55 +01:00
< li > msg.payload.addresses - an array< / li >
< li > msg.payload.txtRecord - an object< / li > < / ul > < / p >
2015-03-04 20:55:53 +01:00
< p > For a full list of official service types see < i > < a href = "http://www.dns-sd.org/ServiceTypes.html" target = "_new" > this list< / a > < / i > .< / p >
< / script >
< script type = "text/javascript" >
RED.nodes.registerType('discovery',{
category: 'network-input',
color:"palegoldenrod",
defaults: {
name: {value:""},
topic: {value:""},
service: {value:"",required:true,validate:RED.validators.regex(/^_.*\._(tc|ud)p$/)}
},
inputs:0,
outputs:1,
icon: "bonjour.png",
label: function() {
return this.name||this.service||"discovery";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
< / script >
2015-05-08 21:57:15 +02:00
2020-02-04 20:09:53 +01:00
< script type = "text/html" data-template-name = "announce" >
2015-05-08 21:57:15 +02:00
< div class = "form-row" >
< label for = "node-input-service" > < i class = "fa fa-gear" > < / i > Service< / label >
< input type = "text" id = "node-input-service" placeholder = "_http._tcp" >
< / div >
< div class = "form-row" >
< label for = "node-input-port" > < i class = "fa fa-random" > < / i > Port< / label >
< input type = "text" id = "node-input-port" placeholder = "9999" >
< / div >
< div class = "form-row" >
< label for = "node-input-txt" > < i class = "fa fa-tasks" > < / i > TxtRecord< / label >
< input type = "text" id = "node-input-txt" placeholder = '"name":"value","name2":"value2"' >
< / div >
< div class = "form-row" >
< label for = "node-input-name" > < i class = "fa fa-tag" > < / i > Name< / label >
< input type = "text" id = "node-input-name" placeholder = "Name of service" >
< / div >
< div class = "form-tips" > %h in the name will be replaced by the machine hostname.< / div >
< / script >
2020-02-04 20:09:53 +01:00
< script type = "text/html" data-help-name = "announce" >
2015-05-08 21:57:15 +02:00
< p > Provides a Bonjour / Avahi / Zeroconf announcement node.< / p >
2017-11-23 21:53:44 +01:00
< p > If < code > msg.payload< / code > is < code > false< / code > - the announcement is stopped. Any other value starts the announcement process.< / p >
2015-05-08 21:57:15 +02:00
< p > The announcement can be customised by the msg if not configured in the edit panel.< / p >
< p > < ul >
2016-03-02 14:26:19 +01:00
< li > < code > msg.service< / code > - For a full list of official service types see < i > < a href = "http://www.dns-sd.org/ServiceTypes.html" target = "_new" > this list< / a > < / i > .< / li >
< li > < code > msg.port< / code > - the tcp or udp port to use.< / li >
< li > < code > msg.name< / code > - the short description name of the service. If you use %h in the name, it will be replaced by the machine hostname.< / li >
< li > < code > msg.txtRecord< / code > - a javascript object of name:value pairs.< / li >
2015-05-08 21:57:15 +02:00
< / ul > < / p >
< / script >
< script type = "text/javascript" >
RED.nodes.registerType('announce',{
category: 'network-output',
color:"palegoldenrod",
defaults: {
name: {value:""},
service: {value:"",required:true,validate:RED.validators.regex(/^_.*\._(tc|ud)p$/)},
port: {value:""},
txt: {value:""}
},
inputs:1,
outputs:0,
icon: "bonjour.png",
align:"right",
label: function() {
return this.name||this.service||"announce";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
< / script >