Skip to content

Commit

Permalink
Merge pull request #136 from vladak/user_data
Browse files Browse the repository at this point in the history
allow to set user data in the init method
  • Loading branch information
FoamyGuy authored Jan 11, 2023
2 parents 7d6834a + ebd5796 commit 10d7045
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion adafruit_minimqtt/adafruit_minimqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class MQTT:
:param int socket_timeout: How often to check socket state for read/write/connect operations,
in seconds.
:param int connect_retries: How many times to try to connect to broker before giving up.
:param class user_data: arbitrary data to pass as a second argument to the callbacks.
"""

Expand All @@ -159,6 +160,7 @@ def __init__(
use_binary_mode=False,
socket_timeout=1,
connect_retries=5,
user_data=None,
):

self._socket_pool = socket_pool
Expand All @@ -176,7 +178,7 @@ def __init__(
self._connect_retries = connect_retries

self.keep_alive = keep_alive
self._user_data = None
self._user_data = user_data
self._is_connected = False
self._msg_size_lim = MQTT_MSG_SZ_LIM
self._pid = 0
Expand Down

0 comments on commit 10d7045

Please sign in to comment.