No easy way to "discover" a mosquitto server

Bug #902916 reported by andypiper
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mosquitto
New
Wishlist
Unassigned

Bug Description

This is definitely "wishlist" rather than "bug".

I've always wondered why messaging resources like a mosquitto broker don't advertise themselves. In my opinion it would make a lot of sense to have them advertise their connection endpoints / ports via DNS SRV records or Bonjour/zeroconf.

Changed in mosquitto:
importance: Undecided → Wishlist
Revision history for this message
Roger Light (roger.light) wrote :

Certainly worth thinking about - but is this used much in practice?

Revision history for this message
andypiper (andypiperuk) wrote :

Well - that's the rub - I've never actually used it because it hasn't been available! However, I can see example cases where it might be interesting... for instance, where an Arduino could discover a named or "first in list" MQTT broker on a local network rather than having a hard-coded IP address, for example.

Certainly running a zeroconf browser on a network these days tends to discover a wide variety of services like chat, screensharing, DAAP iTunes resources etc.

You then of course need to think about security but that "should" be a consideration anyway.

From an enterprise messaging perspective then I could easily imagine that this would ease the creation of "clusters" of JMS servers. Having services advertised certainly makes it easier to configure things in GUI tools... although of course MQTT is typically more suited to headless small devices so it may not make sense to the same extent there.

Just a pondering...

Revision history for this message
michael rushton (msrushton) wrote :

However, would the broker even need to be involved? Would'nt it be a case of a seperate application registering/broadcasting the url of the queue?

This would work, though, if the published info included a list of current topics.

For SSDP, it "seems" to be a case of broadcasting an HTTP packet over udp.

Or perhaps OpenSLP http://www.openslp.org

Revision history for this message
Roger Light (roger.light) wrote :

There's nothing stopping anybody doing that now. Like you say, the broker doesn't need to be involved in lots of cases. For avahi, all you need is an xml service definition file like this: http://pastebin.com/0RhJyZud

The reason the browser might want to be involved is down to configuration. If I listen on port 1884 instead of the default 1883 then I'll have to change my avahi xml file. If the broker is managing the registering then it knows which ports it is listening on and can register them.

Revision history for this message
andypiper (andypiperuk) wrote :

<toy-story-aliens>OooooOOOooooooO</toy-story-aliens>

That's a handy little file, Roger - is that shipped in the mosquitto package?

Might be worth adding a note about that on the mqtt.org wiki.... :-)

Revision history for this message
Amyas Medallon (amyas) wrote :

> This would work, though, if the published info included a list of current topics.

Publishing a list of topics might leak info that you don't want known to user who don't have an ACL to see it:
/giantco/HR/fall_layoffs
/giantco/m_n_a/acq/tumblr
/giantco/HR/telecommute_cutoff

openslp had stagnated for several years iirc, but seems to have picked up a new version in 2013
some bonjour/zerconf discussions
http://serverfault.com/questions/118652/how-to-use-bonjour
http://datatracker.ietf.org/wg/zeroconf/charter/
http://www.webtorials.com/discussions/2012/04/dont-rush-to-bid-adieu-to-apple-bonjour-just-yet.html

Revision history for this message
Rémi SALEMBIER (remi-salembier) wrote :

I am not sure that Mosquitto itself should include a discovery module.
Some people would need MDNS, some others UPNP...

I think Mosquitto should still be fully dedicated to MQTT to keep it small and easy to use and configure. Anyway it should be easy to develop extensions (like a discovery module which would be useful) and share them if possible. The Mosquitto Authentication plugin is a first step in that direction.

Revision history for this message
greypanda (3-joh8-x) wrote :

Yes, it is almost a year later, but for those who may be interested, I am building a HA system using Arduinos with an ethernet connection. Rather than try to discover clients, I think the easiest way to establish connections is for the clients to advertise themselves. Well, that is fine if you want to embed the broker IP in the code, but I like to install the clients and never touch them again. (Well, for a long, long time.) So I added a little Python beacon that broadcasts the broker address on a UDP port.
Then, the client just listens for the broadcast and gets the path to the broker. This makes the Arduino code small since there is no DNS lookups or other exotic machinations. If the broker moves, the Arduino connection fails and it trys again, this time getting the IP of the new broker.

from socket import *
import time

s = socket(AF_INET, SOCK_DGRAM)
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
while True:
        s.sendto('mqtt:192.168.1.81.1883', ('255.255.255.255', 41303))
        time.sleep(10)

Revision history for this message
Roger Light (roger.light) wrote :

Hi there,

I'm migrating bugs to Eclipse. The new url for this bug is:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=452922

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.