Page 1 of 1

Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Posted: Mon Apr 01, 2019 1:55 pm
by PaulVdBergh
Hi All,

I'm working on a mqtt project where I need to know if the client connection to the broker is still active. If the connection is disconnected, the system must asap come to halt.

The first idea was to set a relative low keepalive value and let the client send periodically some dummy publishings.
But looking into the documentation, I discovered the "refresh_connection_after_ms" member of esp_mqtt_client_config_t.

What is the purpose of this member? Can I use it to chech/ensure the connection between the client(s) and the broker?

Thanks,

Paul

Re: Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Posted: Mon Apr 01, 2019 7:13 pm
by ESP_cermak
Hi Paul,

you can use `keepalive` field from the configuration structure (this would send pings to the broker if no communication for given time)

`refresh_connection_after_ms` would actively disconnect and reconnect to the broker if configured.

Re: Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Posted: Wed May 12, 2021 3:11 am
by binhla
Hi, I have a question.

Would the ESP32 disconnect and reconnect even when there is a stable connection or it only happen when there is no ping response from broker?