@@ -168,9 +168,10 @@ class MQTT:
168168 in seconds.
169169 :param int connect_retries: How many times to try to connect to the broker before giving up
170170 on connect or reconnect. Exponential backoff will be used for the retries.
171- :param class user_data: arbitrary data to pass as a second argument to the callbacks.
172- This works with all callbacks but "on_message"; there, it is necessary to extract
173- the user_data from the MQTT object (passed as 1st argument) using the 'user_data' member.
171+ :param class user_data: arbitrary data to pass as a second argument to most of the callbacks.
172+ This works with all callbacks but the "on_message" and those added via add_topic_callback();
173+ for those, to get access to the user_data use the 'user_data' member of the MQTT object
174+ passed as 1st argument.
174175
175176 """
176177
@@ -415,6 +416,9 @@ def add_topic_callback(self, mqtt_topic: str, callback_method) -> None:
415416
416417 :param str mqtt_topic: MQTT topic identifier.
417418 :param function callback_method: The callback method.
419+
420+ Expected method signature is ``on_message(client, topic, message)``
421+ To get access to the user_data, use the client argument.
418422 """
419423 if mqtt_topic is None or callback_method is None :
420424 raise ValueError ("MQTT topic and callback method must both be defined." )
@@ -439,6 +443,7 @@ def on_message(self):
439443 """Called when a new message has been received on a subscribed topic.
440444
441445 Expected method signature is ``on_message(client, topic, message)``
446+ To get access to the user_data, use the client argument.
442447 """
443448 return self ._on_message
444449
0 commit comments