micropython-lib
micropython-lib copied to clipboard
umqtt.simple: Fix MQTTClient publish for connection disruption.
Method now handles OSError: -1 after many packets, attempting reconnection.
Issue #754
Modified the MQTTClient publish method to gracefully handle connection disruptions. Previously, the method encountered an OSError: -1 after sending a large number of packets, leading to a disconnection from the server. The updated method now includes error handling to detect this situation and attempts to reconnect before retrying the operation. This enhancement ensures that the client can recover from connection disruptions seamlessly, maintaining stable communication with the server.