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

Count subscriptions and make unsubscribe only stop if it matches the amount of subscriptions #1959

Open
dzek69 opened this issue Dec 28, 2024 · 0 comments

Comments

@dzek69
Copy link

dzek69 commented Dec 28, 2024

Is your feature request related to a problem? Please describe.
Currently, when I subscribe to a topic more than once it requires only one unsubscribe call to actually stop receiving messages on given topic.
In a large app, that multiple modules may want to listen to some topics on demand, but stop subscription whenever that's not needed anymore.

Describe the solution you'd like
If I subscribe to given topic more than once, it should require exactly the same amount of unsubscribe calls to actually stop for listening to given topic.

Describe alternatives you've considered
Alternative library, if one exists.

Additional context
This is slightly related to #1951 as well, which is another pain point of mqtt.js. If I'd like to create such a wrapper described in the issue - I would bump into problem described here if I'd want to unsubscribe. I'd need to count subscriptions myself and basically wrap the whole library (overridding functions) to make it safe to use with any code.

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