Skip to content

Commit

Permalink
Merge pull request #75 from adafruit/add-timeout
Browse files Browse the repository at this point in the history
Added ability to set loop timeout
  • Loading branch information
brentru committed Jun 22, 2021
2 parents 49d6f48 + 9b17745 commit 5efcef4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adafruit_io/adafruit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ def remove_feed_callback(self, feed_key):
validate_feed_key(feed_key)
self._client.remove_topic_callback("{0}/f/{1}".format(self._user, feed_key))

def loop(self):
def loop(self, timeout=1):
"""Manually process messages from Adafruit IO.
Call this method to check incoming subscription messages.
:param int timeout: Socket timeout, in seconds.
Example usage of polling the message queue using loop.
Expand All @@ -229,7 +230,7 @@ def loop(self):
while True:
io.loop()
"""
self._client.loop()
self._client.loop(timeout)

# Subscriptions
def subscribe(self, feed_key=None, group_key=None, shared_user=None):
Expand Down

0 comments on commit 5efcef4

Please sign in to comment.