Firstly is about connecting with the clean session flag set to false (I would like to have a persistent session ). After I set that flag. The device disconnected right after connected (of course it tried to reconnect it but it doesn't)
Here is my code flow
Of course i tried to comment out the line "mqttClient.setCleanSession(false)" and my device connected normally.
Secondary is about will topic triggered right after reconnected
I used the same code lines above. I tried to turn the device off and will message triggered. But after I turn the device on to make it connect again The will topic fired right after my device connected.
Hi,
I got two problems.
Firstly is about connecting with the clean session flag set to false (I would like to have a persistent session ). After I set that flag. The device disconnected right after connected (of course it tried to reconnect it but it doesn't) Here is my code flow
mqttClient.setCleanSession(false); mqttClient.setWill(BOARD_CONNECTING_STATUS_TOPIC, str.c_str()); mqttClient.setKeepAlive(20); mqttClient.connect(clientId.c_str(), userName.c_str(), userName.c_str());
Of course i tried to comment out the line "mqttClient.setCleanSession(false)" and my device connected normally.
Secondary is about will topic triggered right after reconnected I used the same code lines above. I tried to turn the device off and will message triggered. But after I turn the device on to make it connect again The will topic fired right after my device connected.
I used ESP32