Hi,
I’m new to Python (and IOT). I’m using Paho-mqtt to publish data to Losant. Works very well, but some of my publish.single() submissions are large. I have a hardcoded size limit in the code now to make I submit under the 256k limit.
But in testing I noticed there is no exception or return code that I can use to know if the data was accepted.
Am I missing something, is there a way to do that?
TX!
Vas
So when a message is published that is over the 256K limit, the Losant broker will disconnect the client - so you can use that as an indication that the message was not accepted. Unfortunately, there is no concept of disconnect “status codes” in MQTT - so it isn’t obvious that a large message was the reason for the disconnect.
One other method would be to publish messages with a QoS level of 1, which means the broker will send a PubAck when it accepts a message from the client. I believe that the paho-mqtt has an on_publish callback that you can hook into, and you will receive a callback when a message is accepted by the broker.
Awesome! I might have to try that