To get the data from MQTT broker by an application which data are published by MQTT client publisher

821 views Asked by At

I'm using Mosquitto MQTT broker in my embedded Linux device. The current topology is like below:

MQTT clients(Publishers) -------MQTT broker--------MQTT clients(Subscribers)

To get the data from MQTT broker which data are published by client, shall I create MQTT clients(Subscribers) in my embedded Linux device?

Is there any way to make a simple application in c or c++ to get the data from MQTT broker which data were published by clients(publisher) so that CPU time and memory than creating MQTT client(sub)? Please let me know how. Thank you. //Daum

1

There are 1 answers

3
hardillb On

MQTT v3.1 messages only contain the following information:

  1. Topic
  2. QOS level
  3. Retained flag
  4. Payload

There is no information about who published the message, if you need that information you will need to find a way to encode it in the payload when you publish it or use client specific topics.