Skip to content

Added ability to set loop timeout #75

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

Merged
merged 2 commits into from
Jun 22, 2021
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
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