Skip to content

Add topic-specific callback methods #37

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

Closed
brentru opened this issue Jun 5, 2020 · 0 comments
Closed

Add topic-specific callback methods #37

brentru opened this issue Jun 5, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@brentru
Copy link
Member

brentru commented Jun 5, 2020

Currently, this library returns a message callback containing a topic and payload if a subscription has been updated.

While one could filter for a specific MQTT topic within the on_message method, it is clunky.

This enhancement would add message callbacks which only trigger on a specific topic match.
Note: Topics must be subscribed to, prior to adding the callback handler.

Proposed methods:
message_callback_add(mqtt_topic, callback_method): Connect a user-defined method to a MQTT subscription topic.

message_callback_remove(mqtt_topic, callback_method): Remove a user-defined method from a specific mqtt topic.

Example Usage in Paho MQTT Python: https://github.com/eclipse/paho.mqtt.python/blob/master/examples/client_sub-multiple-callback.py#L45

@brentru brentru added the enhancement New feature or request label Jun 5, 2020
@brentru brentru closed this as completed Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant