hirotakaster / MQTT

MQTT for Photon, Spark Core
Other
216 stars 118 forks source link

Make the publish function blocking #72

Open shivams opened 5 years ago

shivams commented 5 years ago

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.

hirotakaster commented 5 years ago

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.