Features provided by mqtt and node-red

If I connect Mosquitto broker to a Nordred broker, is there a way to know the entire structure of Mosquito clients?
or is there a way to know the client topic structure of Moschito broker?

I am asking you this question because I am investigating whether there is a way to see the entire node structure and the entire topic structure at a glance.

There is nothing like a "Node-RED Broker"
Node-RED MQTT is a client that can connect to one (or multiple) broker(s) and perform usual operations like subscribe and publish.

There is no way for a client to know the entire MQTT topic structure as most of this is dynamic.
A client could subscribe to /# and build a data base from there while receiving messages but there is no structure that can be requested.

1 Like

Node-RED has the same access to information from the broker as any other MQTT client.

That means the only way to see what topics messages are being published on is to subscribe to the wildcard topic # and assuming it has the right access rights in the ACL it will see every message published. But there is no way to know what clients published what messages as that information is not included in the messages.

There is a MQTT broker node (node-red-contrib-aedes) that runs a MQTT broker actually in Node-RED that can provide some more information, I would not recommend using this for anything other than low volume local testing.

If you want to visualise the topic structure then using something like this might help: GitHub - hardillb/d3-MQTT-Topic-Tree: A MQTT Topic Tree viewer using the d3 collapsable tree and MQTT over websockets

1 Like

Thank you very much for your answer. Can't I know the node structure or topic structure even if I use Node-red-crib-aedes?

The important thing to remember is that there is no static topic structure, the broker does not keep track of what has been published.

The process is as follows:

  1. Client publishes a message on a given topic
  2. The broker receives this message and then checks it against the list of topic patterns (not topics, but patterns as they might include wildcards) that each client has sent to the broker
  3. For each matching pattern the broker sends the message to the client with that pattern

It does not keep a list of all topics in use.

The Aedes broker node outputs events for published messages, you could use that the same way as subscribing to '#' but you will still need to build the topic tree based on published messages, there is no magic way to get it all at once, because that information just doesn't exist in the broker.

1 Like

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