adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT

Callback Functions' Parameters Usage

Open
#170 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
81
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I have a few questions and comments concerning the library's callback functions' parameters.

1) What are the `flags`, `rc`, and `pid` parameters provided in some of the MQTT client's callback functions and what are their expected usage? I can't find much information on them in the library's documentation or in the source code itself.

2) The `on_subscribe()` callback provides all of the parameters, `topic` and `qos`, submitted with the `subscribe()` method. However, this is not the case for the `on_publish()` and `publish()` counterparts as the `message`, `retain`, and `qos` parameters are missing. Is it possible to include them in a future update? As an example, I am trying to print the `topic` and `message` to the screen when a message is published. This would be nice to handle within the `on_publish()` callback, but I am instead printing the `topic` and `message` directly after publishing since the `on_publish()` callback does not have access to the topic's message. Is there a way to retrieve the published topic's message within the `on_publish()` callback that I am missing?

3) What is the expected use case for the userdata parameter in some of the callback functions?

Your assistance would be greatly appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the on_subscribe(), on_publish(), subscribe(), and publish() entry points, then trace how flags, rc, pid, and userdata are passed through the callback API. Document the parameters and expected usage, and clarify whether published topic and message data are available in on_publish(); completion means the callback behavior and limitations are unambiguous in the library documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, networking
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.