PTS93 f1f76c01ba Fixes fatal server crash
On Ubuntu (15.10) I get a crash as soon as I add the mdns node to my flow and deploy the flow. After that I have to delete the node out of the flow file, manually, in a text editor to make the flow not crash the server.

The server crashes with the following message:
``
10 Dec 15:16:16 - Error: getaddrinfo -3008
    at errnoException (/usr/lib/node_modules/node-red/node_modules/node-red-node-discovery/node_modules/mdns/lib/resolver_sequence_tasks.js:199:11)
    at getaddrinfo_complete (/usr/lib/node_modules/node-red/node_modules/node-red-node-discovery/node_modules/mdns/lib/resolver_sequence_tasks.js:112:10)
    at GetAddrInfoReqWrap.oncomplete (/usr/lib/node_modules/node-red/node_modules/node-red-node-discovery/node_modules/mdns/lib/resolver_sequence_tasks.js:120:9)
``

I had the same error in my own node.js application that uses mdns. This change should fix it.
2015-12-10 15:31:40 +01:00
..
2015-03-04 19:55:53 +00:00
2015-03-04 19:55:53 +00:00
2015-05-08 23:03:51 +01:00
2015-12-10 15:31:40 +01:00

node-red-node-discover

A Node-RED node that uses Bonjour / Avahi to discover local network services such as iTunes libraries, printers, etc.

Now also supports announcing new services.

Prerequisites

please read the install instructions for the underlying npm.

For Debian / Ubuntu this requires installing

    sudo apt-get install libavahi-compat-libdnssd-dev

Install

Run the following command in the root directory of your Node-RED install, usually ~/.node-red

    npm install node-red-node-discovery

Usage

Discovery

Uses an implemetation of mdns to provide a Bonjour / Avahi service discovery capability.

msg.payload contains the service object on both arrival and leaving.

msg.state contains boolean true or false depending if the service has arrived (true) or gone away (false)..

Within the msg.payload object the most interesting things are:

  • msg.payload.name
  • msg.payload.interface
  • msg.payload.port
  • msg.payload.addresses
  • msg.payload.txtRecord

For a full list of official service types see [this list](http://www.dns-sd.org/ServiceTypes.html" target="_new).

###Announce

Provides a Bonjour / Avahi / Zeroconf announcement node.

If msg.payload is 0 - the announcement is stopped. Any other value starts the announcement process.

The announcement can be customised by the msg if not configured in the edit panel.

  • msg.service - For a full list of official service types see this list.
  • msg.port - the tcp or udp port to use.
  • msg.name - the short description name of the service. If you use %h in the name, it will be replaced by the machine hostname.
  • msg.txtRecord - a set of comma separated name:value pairs

###Note:

When Node-RED starts you will get a big WARNING message about the Bonjour compatability layer... this is just a warning so don't worry.