From cb1e6cf21804b34ab5ab2b6070b4bda139dbf124 Mon Sep 17 00:00:00 2001 From: Rocha Euripedes Date: Tue, 11 Jul 2023 05:34:46 +0800 Subject: [PATCH] docs: Clarify keepalive timeout Adds information on the behavior of the PINGREQ message timeout and some reasoning behind the choice. --- include/mqtt_client.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/mqtt_client.h b/include/mqtt_client.h index e03c615..c0fcb8c 100644 --- a/include/mqtt_client.h +++ b/include/mqtt_client.h @@ -315,7 +315,10 @@ typedef struct esp_mqtt_client_config_t { int retain; /*!< LWT retained message flag */ } last_will; /*!< Last will configuration */ bool disable_clean_session; /*!< *MQTT* clean session, default clean_session is true */ - int keepalive; /*!< *MQTT* keepalive, default is 120 seconds */ + int keepalive; /*!< *MQTT* keepalive, default is 120 seconds + When configuring this value, keep in mind that the client attempts + to communicate with the broker at half the interval that is actually set. + This conservative approach allows for more attempts before the broker's timeout occurs */ bool disable_keepalive; /*!< Set `disable_keepalive=true` to turn off keep-alive mechanism, keepalive is active by default. Note: setting the config value `keepalive` to `0` doesn't disable keepalive feature, but uses a default keepalive period */ @@ -334,7 +337,7 @@ typedef struct esp_mqtt_client_config_t { bool disable_auto_reconnect; /*!< Client will reconnect to server (when errors/disconnect). Set `disable_auto_reconnect=true` to disable */ esp_transport_handle_t transport; /*!< Custom transport handle to use. Warning: The transport should be valid during the client lifetime and is destroyed when esp_mqtt_client_destroy is called. */ - struct ifreq * if_name; /*!< The name of interface for data to go through. Use the default interface without setting */ + struct ifreq * if_name; /*!< The name of interface for data to go through. Use the default interface without setting */ } network; /*!< Network configuration */ /** * Client task configuration