Skip to content

Commit 10d7045

Browse files
authored
Merge pull request #136 from vladak/user_data
allow to set user data in the init method
2 parents 7d6834a + ebd5796 commit 10d7045

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
@@ -139,6 +139,7 @@ class MQTT:
139139
:param int socket_timeout: How often to check socket state for read/write/connect operations,
140140
in seconds.
141141
:param int connect_retries: How many times to try to connect to broker before giving up.
142+
:param class user_data: arbitrary data to pass as a second argument to the callbacks.
142143
143144
"""
144145

@@ -159,6 +160,7 @@ def __init__(
159160
use_binary_mode=False,
160161
socket_timeout=1,
161162
connect_retries=5,
163+
user_data=None,
162164
):
163165

164166
self._socket_pool = socket_pool
@@ -176,7 +178,7 @@ def __init__(
176178
self._connect_retries = connect_retries
177179

178180
self.keep_alive = keep_alive
179-
self._user_data = None
181+
self._user_data = user_data
180182
self._is_connected = False
181183
self._msg_size_lim = MQTT_MSG_SZ_LIM
182184
self._pid = 0

0 commit comments

Comments
 (0)