Skip to content

Commit 3d79f01

Browse files
authored
Merge pull request #29 from radudragusin/patch-1
Allow user to override keepalive on connect
2 parents ac46214 + 15b8789 commit 3d79f01

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Adafruit_IO/mqtt_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ def connect(self, **kwargs):
102102
# Skip calling connect if already connected.
103103
if self._connected:
104104
return
105+
# If given, use user-provided keepalive, otherwise default to KEEP_ALIVE_SEC
106+
keepalive = kwargs.pop('keepalive', KEEP_ALIVE_SEC)
105107
# Connect to the Adafruit IO MQTT service.
106108
self._client.connect(self._service_host, port=self._service_port,
107-
keepalive=KEEP_ALIVE_SEC, **kwargs)
109+
keepalive=keepalive, **kwargs)
108110

109111
def is_connected(self):
110112
"""Returns True if connected to Adafruit.IO and False if not connected.

0 commit comments

Comments
 (0)