Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to set user data in the init method #136

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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