6

There was this recent question in which the OP used iot.eclipse.org as an MQTT broker. This server actually runs the latest released version of Mosquitto broker.

I have advised to check the connection on the broker side and I have checked what are the possibilities. I could not find a way to access the logs provided by iot.eclipse.org's Mosquitto broker.

Anyway does someone know a way to get information about my client from a public broker?

1 Answer 1

4

Subscribing to $SYS/# topic will provide some information about the broker and maybe about the clients. Detailed description of these items can be found here.

There are three main categories to highlight:

  • Static Topics: Messages on a static $SYS topic are not required to be sent on every $SYS topic update interval. These messages are sent once the broker subscribes to the $SYS topic
  • Required Topics: Every broker which claims to support the $SYS topics should support these topics.
  • Optional Topics: A broker implementation may decide if it implements an optional topic.

The one needed to for client status check falls into the "Optional Topics" category.

  • $SYS/clients/[client-id]/ip

  • $SYS/clients/[client-id]/connectedtime

Also, based on this description about Mosquitto's logging, the console log can be logged into a topic ($SYS/broker/log/#) as well.

Two common question are:

  • Can I see all connected clients?
  • Can I list all topics?

The broker doesn’t let you do this directly but by enabling logging to a a topic and monitoring the topic with an MQTT client you can get a good idea.

Probably for privacy and/or security reasons iot.eclipse.org does not have topics for these log entries.

  • No topics for $SYS/clients/

    enter image description here

  • No topics for $SYS/broker/log/#

    enter image description here

For other public brokers these optional topics may exist, you can check them easily with mqtt-spy for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.