Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » List of MqttClient subscriptions
List of MqttClient subscriptions [message #917189] Wed, 19 September 2012 22:24 Go to next message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

I have a MqttClient. How can I have a list of the topics it is subscribed to? I see they are stored in a Hashtable but no public API to get them.
Re: List of MqttClient subscriptions [message #920691 is a reply to message #917189] Sun, 23 September 2012 10:21 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

Response rom the paho-dev list:

Hi Sopot,

as you have seen, there is no public API in the client to retrieve
that information.

So, you either need to maintain that list in your application, or you
could modify the paho client to expose the list.

Regards,
Nick
Re: List of MqttClient subscriptions [message #930652 is a reply to message #920691] Tue, 02 October 2012 14:10 Go to previous messageGo to next message
Andy Piper is currently offline Andy PiperFriend
Messages: 15
Registered: November 2011
Location: Kingston upon Thames, UK
Junior Member

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.


Cloud Foundry Developer Advocate @ Pivotal | Eclipse Paho project co-lead | mqtt.org | andypiper.co.uk

[Updated on: Tue, 02 October 2012 14:15]

Report message to a moderator

Re: List of MqttClient subscriptions [message #1477723 is a reply to message #917189] Tue, 18 November 2014 04:24 Go to previous messageGo to next message
Thuong Nguyen Dac is currently offline Thuong Nguyen DacFriend
Messages: 1
Registered: November 2014
Junior Member
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.
Many Thanks!
Re: List of MqttClient subscriptions [message #1553302 is a reply to message #1477723] Thu, 08 January 2015 16:24 Go to previous message
Ian Craggs is currently offline Ian CraggsFriend
Messages: 17
Registered: March 2013
Junior Member
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.
Previous Topic:Sync Client Publisher and Sync Client Subscriber not working together in Paho CClient
Next Topic:Python client: static publish method
Goto Forum:
  


Current Time: Mon Jan 26 12:34:20 GMT 2015

Powered by FUDForum. Page generated in 0.02109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software