@parasaurolophus/node-red-dnssd

3.1.3 • Public • Published

@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

  1. Stream of Advertiser.instanceRenamed() events
  2. Stream of Advertiser.hostRenamed() events
  3. Stream of Advertiser.stopped() events
  4. 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

  1. Stream of Browser.serviceUp() events
  2. Stream of Browser.serviceDown() events
  3. Stream of Browser.error() events
  4. 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.

Package Sidebar

Install

npm i @parasaurolophus/node-red-dnssd

Weekly Downloads

2

Version

3.1.3

License

MIT

Unpacked Size

180 kB

Total Files

8

Last publish

Collaborators

  • parasaurolophus