Andy Piper Messages: 15 Registered: November 2011 Location: Kingston upon Thames, UK
This would tend to be something that a broker would maintain, but I don't know of any brokers with an API that would enable you to obtain such a list.
In many ways the publish/subscribe model is aimed at completely decoupling publishers and subscribers - you don't know whether your publication is passed on to 0, 1 or many subscribers, and it "should not" matter. On the subscriber side, you make the choice which topics to listen to.
MQTT doesn't provide any method to obtain this and therefore Paho does not implement it. Per Nick's suggestion you could maintain a list or modify the client. It is probably simplest just to remember which topics you subscribe to as you go.
I'm new with paho. I think it will be good if we can get list subscribed topics. I don't understand why paho dev team didn't provide API to get list subscribed topics? Please some one could answer my question.
There is no API to get the list of subscribed topics, because that is not part of the MQTT protocol. It is a function which some MQTT servers might provide, but would be server specific.
A client library could support it, but it would have to keep a record of subscriptions itself, which is equally something the application could do. The libraries are intended to be small, so we don't want to add lots of functions. Having said that, it's worth considering as an enhancement.