Left here for archival purposes.

User avatar
By Jorelu
#23647 mqtt:publish( topic, payload, qos, retain, function(client) )
function(client): callback fired when PUBACK received. - doesn't work correclty

I have a piece of code:
tmr.alarm(0, 2000, 1, function()
if(busyFlag == 0) then
busyFlag = 1
m:publish("some topic", "some message", 0, 0, function(client)
busyFlag = 0
end)
print(counter)
counter = counter + 1
end
end)

The problem is that sometimes the callback function is not called when the PUBACK is received. The busyFlag remains always 1 and i can't publish again. If i manually change the flag again to 0 it will continue to work.

I'm using the 0.9.6 float firmware on my esp8266. Usually i am able to publish 30-40 times to the broker.
How to solve this issue?