@parasaurolophus/node-red-dnssd
v3.1.3
Published
Wrap dnssd package for Node-RED
Downloads
41
Maintainers
Readme
@parasaurolophus/node-red-dnssd
Wrap @gravitysoftware/dnssd for use in Node-RED.
This provides a superset of the functionality supported by node-red-node-discovery, without generating any warnings in the Node-RED log.
Tested with Node-RED 3.1 running on Node.js 20.x. May not be compatible with older versions.
dnssd-advertisement
Input
msg.payload.command
specifies a dnssd.Advertisement
method to invoke:
start
Start responding to service enquiries from browsers.
{ "payload": {
"command": "start"
[, "service": name]
[, "udp": boolean]
[, "port": number]
[, "options": json]
}
}
If the optional service
name, udp
, port
number or options
values are
provided, they will override the node's configuration.
stop
Broadcast a "service down" event.
{ "payload": { "command": "stop" } }
updateTXT
Update the TXT
record. (Note that this is provided for completeness but is of
limited utility since it does not trigger any of the events exposed by the
dnssd.Browser
object.)
{
"payload": {
"command": "updateTXT",
"txt": {
"foo": "bar"
}
}
}
Outputs
- Stream of
Advertiser.instanceRenamed()
events - Stream of
Advertiser.hostRenamed()
events - Stream of
Advertiser.stopped()
events - Stream of
Advertiser.error()
events
dnssd-browser
Input
msg.payload.command
specifies a dnssd.Browser
method to invoke:
start
Begin listening for service life-cycle events.
{
"payload": {
"command": "start"
[, "service": name]
[, "udp": boolean]
}
}
If the optional service
name or udp
values are provided, they will override the node's configured values.
stop
Stop listening for service life-cycle events.
{ "payload": { "command": "stop" } }
list
Send a list of running services.
{ "payload": { "command": "list" } }
Outputs
- Stream of
Browser.serviceUp()
events - Stream of
Browser.serviceDown()
events - Stream of
Browser.error()
events Browser.list()
results
Details
This is a deliberately thin wrapper around the functionality exposed by @gravitysoftware/dnssd, which is a pure JavaScript implementation of DNS-SD.
The Service configuration string is the name of the DNS-SD service to
broadcast using dnssd-advertisement
or watch using dnssd-browser
.
By default, these nodes will use TCP. The Use UDP? configuration checkbox tells them to use UDP instead.
dnssd-advertisement
also requires a Port number and can optionally take
Options, including a txt
record. Options may be specified using JSON or
JSONata.
These nodes do not start automatically even if they are fully configured. Use
inject
nodes configured to send messages when flows are (re-) started if
required for your purposes.