Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

User avatar
PaulVdBergh
Posts: 58
Joined: Fri Feb 23, 2018 4:45 pm
Location: Brasschaat, Belgium

Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Postby PaulVdBergh » Mon Apr 01, 2019 1:55 pm

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

ESP_cermak
Posts: 69
Joined: Thu Nov 01, 2018 8:32 am

Re: Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Postby ESP_cermak » Mon Apr 01, 2019 7:13 pm

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.

binhla
Posts: 10
Joined: Tue Nov 12, 2019 2:25 am

Re: Meaning of esp_mqtt_client_config_t.refrech_connection_after_ms

Postby binhla » Wed May 12, 2021 3:11 am

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?

Who is online

Users browsing this forum: No registered users and 113 guests