Closed tinamore closed 4 years ago
I am wondering code is missing: not auto send ping every keeplive / 3.
The reconnect method is in fact the connect(clean_session=False) method with additions.
And the connect method with cleean_session=False sets "Last Will" correctly. I tested it just now.
You would need to see what messages are displayed on REPL.
Perhaps something else is affecting this problem. From my point of view, everything works.
The programmer is responsible for maintaining the connection. So you have to choose the keep_alive parameters yourself and send a ping to make the connection active.
There are many different strategies for maintaining the connection, and that is why it is on the programmer's side to keep the connection active.
The problem is also under micropython to keep some code in the background to perform some tasks. That's why this library leaves it up to the programmer to choose their own methods to keep the connection active.
First, I set keepalive = 15s I don't understand why the reconnect for 15s. Then I discovered that robust2 did not ping automatically. Each time will be blocked 1-2 seconds due to the reconnect process but call Ping is very fast. I think you should add in the readme the need to maintain keepAlive with Ping().
Thank you very much for the great lib MQTT for micropython library. I hope it will be stable like mqtt pubsub library in arduino.
Describe the bug set_last_will not working if only use reconnect without connect first I use A9G board
There's no guarantee that GPRS connects successfully the first time, so I don't call the connect () function. I just called reconect in the for loop. I am suspicious that reconect () didn't send the Last Will and Testament attached
I disconnected the power from the board but within a few minutes I still didn't see it offline.
To Reproduce Steps to reproduce the behavior:
Details (please complete the following information):