MQTT
MQTT copied to clipboard
Make the publish function blocking
I put my device to sleep after publishing. However, I have to provide a delay of a few seconds before that, so that publishing is done. Is there any way to know the status of publishing before going to sleep? Alternatively, is there some flag to make the publish function blocking, so that the code doesn't proceed ahead without the publishing been done.
publish function is synchronize method. If publish function done, your data already send to mqtt server. otherwise, you cloud use the QoS =1|2 callback function(mqttqostest.ino) for your checking data.