diff --git a/examples/native_networking/minimqtt_adafruitio_native_networking.py b/examples/native_networking/minimqtt_adafruitio_native_networking.py index a828d25..6563204 100644 --- a/examples/native_networking/minimqtt_adafruitio_native_networking.py +++ b/examples/native_networking/minimqtt_adafruitio_native_networking.py @@ -89,7 +89,7 @@ def message(client, topic, message): photocell_val = 0 while True: # Poll the message queue - mqtt_client.loop() + mqtt_client.loop(timeout=1) # Send a new message print(f"Sending photocell value: {photocell_val}...") diff --git a/examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py b/examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py index 3608445..5aad73c 100644 --- a/examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py +++ b/examples/native_networking/minimqtt_pub_sub_blocking_native_networking.py @@ -91,7 +91,7 @@ def message(client, topic, message): # NOTE: Network reconnection is handled within this loop while True: try: - mqtt_client.loop() + mqtt_client.loop(timeout=1) except (ValueError, RuntimeError) as e: print("Failed to get data, retrying\n", e) wifi.reset() diff --git a/examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py b/examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py index 9e50bb0..86f4e9c 100644 --- a/examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py +++ b/examples/native_networking/minimqtt_pub_sub_blocking_topic_callbacks_native_networking.py @@ -103,7 +103,7 @@ def on_message(client, topic, message): # NOTE: NO code below this loop will execute while True: try: - client.loop() + client.loop(timeout=1) except (ValueError, RuntimeError) as e: print("Failed to get data, retrying\n", e) wifi.reset()