Espressif Systems ESP Faq page 118

Table of Contents

Advertisement

Chapter 4. Software framework
Does MQTT support automatic reconnection?
• The automatic reconnection of MQTT is controlled by the disable_auto_reconnect variable of struct
esp_mqtt_client_config_t. The default value of disable_auto_reconnect is false, which means that
automatic reconnection is enabled.
• The reconnection timeout value can be set using reconnect_timeout_ms.
What are the supported MQTT versions of ESP-IDF?
ESP-IDF currently supports MQTT 3.1 and MQTT 3.1.1, and MQTT 5.0.
When a Wi-Fi connection is disconnected in ESP-IDF, will the memory previously requested by MQTT upper
layer protocol be automatically released?
• No, but you do not need to care about this memory. What you need to care about is the application layer that
ESP encapsulates.
• For MQTT application layer components, you get an MQTT handle when initializing MQTT. You only need
to care about the memory in this handle. When not using MQTT, you can call stop or destroy to release
the corresponding MQTT memory. When Wi-Fi is disconnected and connected, you do not need to release
the MQTT memory or reapply for the handle, because there is an automatic reconnection mechanism in the
MQTT component.
For ESP32-C3 MQTT, can I not set corrresponding client_id but configure it as an empty string by
default?
• Yes, you can achieve this by setting set_null_client_id to true in the application code.
When MQTT_EVENT_PUBLISHED is triggered after an ESP-IDF MQTT client has published data with QoS
of 1 or 2, does it mean that a proper ack has been received from the other side to prove that the publish has
completed? Or does it just mean that the data was successfully sent to the server once?
The MQTT_EVENT_PUBLISHED event triggered means that the broker has acknowledged receipt of
the messages published by the client, proving that the publish has completed successfully.
How does an ESP MQTT client manually release MQTT resources after disconnection?
Calling the
esp_mqtt_client_destroy
Espressif Systems
API will do the trick.
101
Submit Document Feedback
Release master

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP and is the answer not in the manual?

This manual is also suitable for:

Esp32Esp8266Esp32-s2Esp32-c3Esp32-s3

Table of Contents