Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Device: Auto Discovery

Hi Pakaj,

like Andy reported, if you are the MQTT client and want to discover the MQTT broker in the same network, the only way is to use additional libraries which are able to broadcast messages from broker to clients with the information for the connection (Avahi or UPnP are two examples).
If instead you are already connected to an MQTT Broker (maybe hard coded) and want to discover the other devices, you could use a common topic and send an heartbeat to it from all the devices.
For example:

- Device A connect to broker and subscribe to topic "ANNOUNCE".
- Device A start to send every 10 secs a message to the topic "ANNOUNCE" with the information about itself (ip address, uuid, topic on which it post data)
- Device B connect to broker and subscribe to topic "ANNOUNCE". Will start to be notified by the messages sent by Device A
- Device B start to send every 10 secs a message to the topic "ANNOUNCE" with the information about itself

The main idea is to share a topic between devices to allow them to exchange heartbeat messages.

Hopes this helps,
Lorenzo

On Tue, May 5, 2020 at 3:34 PM Andy Stanford-Clark <ANDYSC@xxxxxxxxxx> wrote:
Hi Pankaj
there is nothing in MQTT natively to support advertising and directory services, but I know a number of people have implemented this using Avahi / mDNS type systems, with a service advertisement for not only the broker, but sometimes including the "kind of information" you'd find there on which topics.

But it is roll-your-own, with no agreed standardisation in the advertisement strings

Here are some helpful links...

https://gist.github.com/marciogranzotto/20e45b83bbcca11e267708b10507c54a

https://raspberrypi.stackexchange.com/questions/101333/avahi-zeroconf-mdns-mqtt-network

http://dagrende.blogspot.com/2017/02/find-mqtt-broker-without-hard-coded-ip.html


Regards
Andy

Andy Stanford-Clark
IBM CTO - UK and Ireland

Distinguished Engineer, Master Inventor, IBM Quantum Ambassador,
Member IBM Academy of Technology, Fellow BCS
Visiting Professor at Newcastle, Southampton and UEA.

Tel: +44 (0)7801 787096 [internal: 37 277624]   twitter: @andysc




From:        "Kumar, Pankaj" <pankaj_kumar2@xxxxxxxxxx>
To:        "paho-dev@xxxxxxxxxxx" <paho-dev@xxxxxxxxxxx>
Date:        05/05/2020 12:37
Subject:        [EXTERNAL] [paho-dev] Device: Auto Discovery
Sent by:        paho-dev-bounces@xxxxxxxxxxx



All,

 

I was looking for capability to automatically discover/monitor nearby devices connected to a Broker.

 

Does MQTT natively supports this ? What are some of those constructs that I can use to implement this.

 

Regards

Pankaj

 

 

 _______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/paho-dev



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/paho-dev

Back to the top