Flavia Caforio 470cb93049 mqtt_client: Manage disconnect packet
In the mqtt5 protocol the broker can disconnect the client with
a disconnect packet. This packet contains a reason value that can be
useful for certain applications in which it is important to know
the reason of disconnection.
While the client is connected is possible that a disconnect packet
is reaceived by the broker to force a disconnection. Before this
patch this approach causes a generic error on transport in case of
disconnection from the broker. If the packet is managed before getting
an error it is possible to save the reason code in the
disconnect_return_code variable in the error_handle, and dispatch
the disconnect event that can be managed by the application event
loop, that now can know the reason of disconnection from the broker.
Reset the variable in case of error.

Signed-off-by: Flavia Caforio <flavia.caforio@amarulasolutions.com>
2025-02-18 16:24:13 +01:00
2023-06-01 13:55:48 +02:00
2025-02-18 16:24:13 +01:00
2018-02-16 02:40:16 +07:00
2023-06-19 10:34:18 +02:00
2023-06-30 10:17:32 +02:00
2016-09-11 10:16:33 +07:00

Twitter Follow GitHub contributors

ESP32 MQTT Library

Features

  • Based on: https://github.com/tuanpmt/esp_mqtt
  • Support MQTT over TCP, SSL with mbedtls, MQTT over Websocket, MQTT over Websocket Secure
  • Easy to setup with URI
  • Multiple instances (Multiple clients in one application)
  • Support subscribing, publishing, authentication, will messages, keep alive pings and all 3 QoS levels (it should be a fully functional client).

How to use

ESP-MQTT is a standard ESP-IDF component. Please refer to instructions in ESP-IDF

Documentation

License

Older IDF verisons

For ESP-IDF versions prior to IDFv3.2, please clone as a component of ESP-IDF:

git submodule add https://github.com/espressif/esp-mqtt.git components/espmqtt

and checkout the ESP-MQTT_FOR_IDF_3.1 tag

S
Description
Mirror of https://github.com/espressif/esp-mqtt.git for ESP-IDF submodules
Readme Apache-2.0 3.8 MiB
Languages
C 78.7%
C++ 11.7%
Python 7.3%
CMake 2.1%
Shell 0.2%