Skip to content

Commit ebd5796

Browse files
committed
allow to set user data in the init method
fixes #135
1 parent 0e5bb0c commit ebd5796

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class MQTT:
138138
:param int socket_timeout: How often to check socket state for read/write/connect operations,
139139
in seconds.
140140
:param int connect_retries: How many times to try to connect to broker before giving up.
141+
:param class user_data: arbitrary data to pass as a second argument to the callbacks.
141142
142143
"""
143144

@@ -158,6 +159,7 @@ def __init__(
158159
use_binary_mode=False,
159160
socket_timeout=1,
160161
connect_retries=5,
162+
user_data=None,
161163
):
162164

163165
self._socket_pool = socket_pool
@@ -175,7 +177,7 @@ def __init__(
175177
self._connect_retries = connect_retries
176178

177179
self.keep_alive = keep_alive
178-
self._user_data = None
180+
self._user_data = user_data
179181
self._is_connected = False
180182
self._msg_size_lim = MQTT_MSG_SZ_LIM
181183
self._pid = 0

0 commit comments

Comments
 (0)