Closed srghafoori closed 3 years ago
Hi @srghafoori, could you please provide more information.
The library is platform-agnostic. You have to implement your own Network
class including the connected()
method.
I have never used ESP32 and RTOS, the Task-WDT
looks like a watchdog task, you should guarantee you do not block it.
If I understood correctly the problem with MqttClient.isConnected
returning true when the connection is actually broken.
Try to collect more logs with with MQTT_LOG_ENABLED
:
define MQTT_LOG_ENABLED 1
Hi @monstrenyatko
Yes, this library is not under RTOS, I just wanted to say that if someone has similar conditions, they can use this solution.
About MqttClient.isConnected
it returns FALSE about 20 to 30 seconds after disconnection.
Good luck
@srghafoori, sorry if I miss something but I do not see the conditions in your original message. MqttClient.isConnected is true after successful connect call and till:
The MQTT protocol has no way to sense the disconnection until the next communication, you may need to adjust your keep-alive interval
Hi, @monstrenyatko Thanks for the tip
Hi
In this situation Task-WDT reboot will occurred in ESP32 when we used RTOS:
isConnected()
(ornetwork.connected()
) returned trueThen when we are waiting for message ACK, Task-WDT may overflow (Depends on overflow time). To resolve the problem, we can add feed functions like
vTaskDelay()
somewhere in do while loop inwaitFor()
function or it's better add it toelapsedMs()
function.Thanks All