# How to know subscribed users and their topics?

**URL:** https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125
**Category:** General
**Created:** [30 August 2022 13:41 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125 "2022-08-30T13:41:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![LuisPereira](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@LuisPereira](https://discourse.nodered.org/u/LuisPereira)
#### Post date: [30 August 2022 13:41 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/1 "2022-08-30T13:41:44Z")

</div>

Hi everyone

I have been looking for a way to know which clients are connected my broker and to which topics. I'm using esp32 as clients with PubSubClient.h library. the esp32 has to five a client name on the connection moment, and later it has to subscribe to some topic if we expect it to receive their publishes...so we should be able to see this information..correct?

I'm currently using mosquitto and if I subscribe to $SYS/broker/clients/connected, $SYS/broker/clients/total or $SYS/broker/subscriptions/count I get a payload with the current number of clients connected , total clients or subscriptions made. But never the name of the clients or the topics.

Is there a way?

Thank you.  
Cheers, Luís Pereira.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [30 August 2022 13:45 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/2 "2022-08-30T13:45:34Z")

</div>

There is nothing in the MQTT protocol that defines what Brokers should do in this area. Any solution (if there is one) will be specific to the particular broker you are using - something you don't mention.

I'm guessing you're using mosquitto? I do not think it exposes the sorts of details you are looking for on any of the `$SYS` topics.

---

<div class="post-metadata">

### Author: ![LuisPereira](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@LuisPereira](https://discourse.nodered.org/u/LuisPereira)
#### Post date: [30 August 2022 14:08 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/3 "2022-08-30T14:08:39Z")

</div>

Thank you for the response. Yes I'm using mosquitto, and accoding to [this](https://manpages.ubuntu.com/manpages/xenial/man8/mosquitto.8.html) thereisn't a $SYS for specific topics. But what about other brokers, do you know anything that comes close to what I mention?  
Thank you.  
Cheers, Luís Pereira.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [30 August 2022 14:29 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/4 "2022-08-30T14:29:14Z")

</div>

The built in dashboard of emqx allows you to see who is subscribing what topics

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/7172e74e0c7747f24022d962cb412334d0b89077.png)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 August 2022 16:39 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/5 "2022-08-31T16:39:50Z")

</div>

It is likely that Mosquitto will show that data in its logs if you turn up the logging level, you would need to access it from there.

Some other thoughts here: [Get a list of connected client IDs from MQTT client - Stack Overflow](https://stackoverflow.com/questions/9767040/get-a-list-of-connected-client-ids-from-mqtt-client)

Not sure if MQTT v5 adds anything in this area?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 October 2022 16:40 UTC](https://discourse.nodered.org/t/how-to-know-subscribed-users-and-their-topics/67125/6 "2022-10-30T16:40:23Z")

</div>

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