Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get subscription topics #67

Closed
ghost opened this issue Jun 4, 2015 · 2 comments
Closed

Get subscription topics #67

ghost opened this issue Jun 4, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 4, 2015

I'm thinking about implementing a method to get all topics that the client subscribes to. Use case is as bellow:

  1. Client subscribes to topics [A,B,C,D]
  2. A new update comes in. Client has to subscribe to [B,C,D] ONLY.
  3. Therefore, if I can retrieve the topics that client has subscribed to before ie. [A,B,C,D], I only have to ask client to unsubscribe to [A] since I know that by [A,B,C,D] - [B,C,D] = [A]. Otherwise, I have to ask client to unsubscribe to [A,B,C,D], and then subscribe back to [B,C,D].

Any thought?

@njh
Copy link
Owner

njh commented Jun 15, 2015

Hello Tommy,

Sorry for not getting back to you faster.
I have never had this requirement for any of my uses of MQTT. And the client code doesn't currently maintain a local copy of subscriptions.

I don't think I fully understand your use-case and why a client would unsubscribe from a topic due to a update from another topic. But I suspect it would best be handled in your application code - with a wrapper round the subscribe/unsubscribe functions.

nick.

@njh njh closed this as completed Jun 15, 2015
@ghost
Copy link
Author

ghost commented Jun 15, 2015

Hi Nick,

I think most of your use-cases just require the application codes to subscribe to mqtt broker statically, i.e. after subscribing, there is no further change. But for my use-case, I keep receiving update from an event. Thus I have to sub/unsubscribe accordingly.

You are right that I can handle it in my application code, which is what I'm doing today. But I think if there are more interests in implementing it within this gem, we can start to think about it. At the moment, this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant