Skip to content

Commit b344704

Browse files
author
brentru
committed
add threaded loop stop
1 parent b5bf7cd commit b344704

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Adafruit_IO/mqtt_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,16 @@ def disconnect(self):
139139
if self._connected:
140140
self._client.disconnect()
141141

142-
def loop_background(self):
142+
def loop_background(self, stop=None):
143143
"""Starts a background thread to listen for messages from Adafruit.IO
144144
and call the appropriate callbacks when feed events occur. Will return
145145
immediately and will not block execution. Should only be called once.
146+
147+
Params:
148+
- stop: boolean, stops the execution of the background loop.
146149
"""
150+
is stop:
151+
self._client.loop_stop()
147152
self._client.loop_start()
148153

149154
def loop_blocking(self):

0 commit comments

Comments
 (0)