Hi Stefano, > I'm a bit confused by observing that the call to mqttc.loop() takes exactly > 1sec to execute, is there any reason for this? What if I need to react more > often in a loop?
loop() has a timeout parameter which is by default 1 second. When you call loop(), it makes a select() call to ask if there is any incoming or (if applicable) outgoing network data to be processed. It will wait at most the amount of time specified by the timeout. If you are only sending data, then your call to publish() will attempt to write its message without needing the loop() call. This means that when you come to call loop(), there is no outgoing data and most probably no incoming data, so the select() call will hit the timeout. If you test over a long while you may see that occasionally the loop() call is shorter when a ping is made for example. In 0.15, the timeout parameter is an integer number of milliseconds. Try set it to 100 for example. In 0.16 (the upcoming pure Python version) it will be a float number of seconds. I hope this help. Cheers, Roger _______________________________________________ Mailing list: https://launchpad.net/~mqtt-users Post to : [email protected] Unsubscribe : https://launchpad.net/~mqtt-users More help : https://help.launchpad.net/ListHelp

