Hello, I am trying to understand how to create a Python client that is resilient to connection/connectivity problems.
I'm using the latest Paho MQTT client on Win8 and Python 2.7.4. This is just my development platform, my plan is to deploy the code on RaspberryPi with a WiFi adapter. When I try this simple publish code: mqttclient.connect(HOST, PORT, 60) while True: payload = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") print('About to publish: {P}'.format(P=payload)) mqttclient.publish("Jon", payload, 1, retain=False) # wait for 10 seconds time.sleep(10) it publishes to my Mosquitto broker every 10 seconds, and I'm able to subscribe to these messages by topic. If I break the connection, however, or stop the broker service - it crashes the client on the next attempt to publish. (this happens using all 3 QOS options) Is there anything in the Paho MQTT client that can help me queue these published messages until the broker becomes available again? Any example code available that would show me how to gracefully handle these connection errors? Thanks in advance. Jon
-- Mailing list: https://launchpad.net/~mosquitto-users Post to : mosquitto-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~mosquitto-users More help : https://help.launchpad.net/ListHelp