Skip to content

Commit 5efcef4

Browse files
authored
Merge pull request #75 from adafruit/add-timeout
Added ability to set loop timeout
2 parents 49d6f48 + 9b17745 commit 5efcef4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_io/adafruit_io.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@ def remove_feed_callback(self, feed_key):
218218
validate_feed_key(feed_key)
219219
self._client.remove_topic_callback("{0}/f/{1}".format(self._user, feed_key))
220220

221-
def loop(self):
221+
def loop(self, timeout=1):
222222
"""Manually process messages from Adafruit IO.
223223
Call this method to check incoming subscription messages.
224+
:param int timeout: Socket timeout, in seconds.
224225
225226
Example usage of polling the message queue using loop.
226227
@@ -229,7 +230,7 @@ def loop(self):
229230
while True:
230231
io.loop()
231232
"""
232-
self._client.loop()
233+
self._client.loop(timeout)
233234

234235
# Subscriptions
235236
def subscribe(self, feed_key=None, group_key=None, shared_user=None):

0 commit comments

Comments
 (0)