Discover NodeRED Instance using mDNS / Bonjour

I thought it would be a great idea to add a mDNS responder to NodeRED itself so that it can be found. This is particularily interesting for programs which want to use the NodeRED REST API as they could just discover it if it is running on the local network.

I'd be happy to submit a PR but I thought I'd ask first if this is something which could be merged.

Probably as easy to do as a one line command rather than have to add extra libraries and possibly native bindings to the core

mDNS can generate a large amount of traffic on a local area network.

NCSC: Openly Accessible mDNS Servers

Not sure whether that is something we would want in the core? Certainly would need to be optional.

My suggestion would be to create a plugin for node-red then you can install it on your instances. If you publish this to github+npm then other users can choose to install or not.

Thanks for all the fast answers!

My idea was the following:
Use bonjour-service - npm because it is written in plain TypeScript and does not require any native dependencies.

Advertise NodeRED using

import Bonjour from 'bonjour-service'
const instance = new Bonjour()
instance.publish({ name: 'Node-RED', type: 'nodered', port: 1880 })

and that's it.

A plugin is a good idea, however, the whole point of the mDNS Discovery originally was that my software can detect NodeRED without requiring the user to do something first. By the way, I can't find docs for writing a plugin, only on how to create Nodes... Can you point me to the right page?

Regarding the traffic on the network:
I agree that this could be a problem. But what if you could enable or disable it in the settings?

As a plugin and with an option switch, that would be OK. Then people can make the appropriate choices. In some environments, mDNS wouldn't be allowed in any case so it has to be optional.

I would have a look at this first:

It supports both discovery and announce.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.