After closed the disconnect issue, I discovered that it would blocking 3-5s when publish.
I guess the disconnect issue was to prevent mqtt disconnection caused by blocking, but the blocking problem has not been solved.
Maybe somewhere still need to be sloved.
When I set the publish freq. to 1 Hz, you can see the publish would blocking 3s sometimes.
The delay is caused by recvTimeout, and the code is working as intended. When not publishing, the MQTT client main loop is continuously polling for new received data, each time this happens, it may take up to 3 seconds, thus leading to the ~3 second between messages. So to solve the delay issue, you should change the recvTimeout to a time duration shorter than your intended publish frequency.
hi @daphwl ,
When I set recvTimeout to 5 and change the publish frequency to 10Hz, it would still happend the data lost.
I’m not sure where the problem might be.
The problem jsut like the picture shown.
I’m not sure it is due to network congestion.
I publish data to public hivemq broker, and It occurs once in a few minutes.
How package size you publish ?
My package size is 700-800 bytes.
In the past, I sent to the local SIoT Broker at a frequency of 10Hz and this problem did not occur, so this issue caused by data processing can be ruled out.
After testing on my side, i didn’t see any issue. I tested it with public hivemq broker and my package size is 744 bytes. You should try to set up a mqtt broker on your computer in your own network, and see if the issue still exists.
Hi @daphwl ,
When I try the local broker, it still happen the blocking issue.
In my project, I use lot of function such as ntp, rtc,uart,watchdog…etc.
So I dont know how to let you reproduce the issue…
I will keep testing to find the problem.
Hi @daphwl ,
After testing, I think the blocking was caused by the quality of the network.
When I use iPhone as AP, there is a possibility of blocking.
Another test was to remove the IPEX antenna, which also caused frequent blocking issue.
But sometimes the blocking time will be as high as tens of seconds, which does not seem to be a good phenomenon.