Skip to content

Commit

Permalink
allow to set user data in the init method
Browse files Browse the repository at this point in the history
fixes #135
  • Loading branch information
vladak committed Dec 23, 2022
1 parent 0e5bb0c commit ebd5796
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 @@ -138,6 +138,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 @@ -158,6 +159,7 @@ def __init__(
use_binary_mode=False,
socket_timeout=1,
connect_retries=5,
user_data=None,
):

self._socket_pool = socket_pool
Expand All @@ -175,7 +177,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 ebd5796

Please sign in to comment.