-
Notifications
You must be signed in to change notification settings - Fork 53
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
Use message callback on subscriptions rather than globally #60
Comments
@DurandA I like this approach, we will start working on this 👍 |
Hello, is somebody working on this? Thinking about implementing it myself. |
Hello. I've extended the mqtt client. Features:
License of this snippet is whatever is the most permissive license compatible with this library. Also, you can also use this decorator:
|
Hi @edocod1, Thanks for your snippet, but we can't do in that way - because Fill free to create a PR for that feature, we will review it and help you with implementation |
Aww, i actually had an implementation compatible with 3.11, but I've dropped it since i prefer doing it in a cleaner way with subscription_identifier. Maybe I'll reimplement it later. |
You can create a new example (in examples folder) with your code of extended MQTTClient instance and make a note that it will work only in 5 version of protocol; |
@edocod1 would you be open to collaboration on your fork? If yes, please give me access to your fork and we can work away at the issues until the PR is accepted. |
Hi @skewty! That snippet there is all i have. I just expanded the Client class to add my own convenience method! The whole repo is actually a p2p web-crawler using mqtt for metrics and communication between peers |
Right now, message handlers are attached globally on the mqtt client:
mqtt_client.on_message = on_message
Would it be possible to attach a message handler to a Subscription? I am thinking of something along the lines of:
The text was updated successfully, but these errors were encountered: