# Discover NodeRED Instance using mDNS / Bonjour

**URL:** <https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813>\
**Category:** Feature Requests\
**Created:** [18 May 2022 17:05 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813 "2022-05-18T17:05:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrueger](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hrueger](https://discourse.nodered.org/u/hrueger)\
**Post date:** [18 May 2022 17:05 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/1 "2022-05-18T17:05:08Z")

</div>

Hi,  
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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 May 2022 18:09 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/2 "2022-05-18T18:09:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 May 2022 18:17 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/3 "2022-05-18T18:17:37Z")

</div>

> [@hrueger](#):
>
> mDNS

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

[NCSC: Openly Accessible mDNS Servers](https://www.ncsc.gov.ie/emailsfrom/DDoS/mDNS/#:~:text=The%20Multicast%20Domain%20Name%20System,have%20a%20local%20DNS%20server.)

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 May 2022 19:05 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/4 "2022-05-18T19:05:28Z")

</div>

> [@hrueger](#):
>
> I'd be happy to submit a PR but I thought I'd ask first if this is something which could be merged

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.

---

<div class="post-metadata">

**Author:** ![hrueger](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hrueger](https://discourse.nodered.org/u/hrueger)\
**Post date:** [19 May 2022 05:48 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/5 "2022-05-19T05:48:53Z")

</div>

Thanks for all the fast answers!

My idea was the following:  
Use [bonjour-service - npm](https://www.npmjs.com/package/bonjour-service) because it is written in plain TypeScript and does not require any native dependencies.

Advertise NodeRED using

```nohighlight
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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 May 2022 09:15 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/6 "2022-05-19T09:15:47Z")

</div>

> [@hrueger](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![lu4t](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lu4t/32/32276_2.png) [@lu4t](https://discourse.nodered.org/u/lu4t)\
**Post date:** [20 May 2022 18:56 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/7 "2022-05-20T18:56:23Z")

</div>

I would have a look at this first:

> **[node-red-node-discovery](https://flows.nodered.org/node/node-red-node-discovery)**
>
> A Node-RED node that uses Bonjour / Avahi to discover nearby services.

It supports both discovery and announce.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 July 2022 18:57 UTC](https://discourse.nodered.org/t/discover-nodered-instance-using-mdns-bonjour/62813/8 "2022-07-19T18:57:16Z")

</div>

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