I'm working on an ESP32 project that so far works well. I'm using the PubSubClient library to connect to the AWS IoT core but that one has a blocking method that I would prefer to not use.
I found the ESP-IDF MQTT implementation which seems to also work, but I haven't found anything in the documentation that mentions if it is blocking or not.
Can someone with more expertise int he codebase help me solve this question?
Thanks a lot in advance
Is ESP-IDF MQTT implementation asynchronous?
Re: Is ESP-IDF MQTT implementation asynchronous?
mqtt client implementation in ESP_IDF runs in its own task: esp_mqtt_task.
Messages from subscribed topics, are delivered at the application level via an event handler which you need to implement and register. So, receiving is asynchronous
Published messages looks to by synchronous, and it make sense because you might have other QOSes than 0.
[edit]
You also have the unblocking version of publish
See the details herehttps://docs.espressif.com/projects/esp ... /mqtt.html
Messages from subscribed topics, are delivered at the application level via an event handler which you need to implement and register. So, receiving is asynchronous
Published messages looks to by synchronous, and it make sense because you might have other QOSes than 0.
[edit]
You also have the unblocking version of publish
Code: Select all
int esp_mqtt_client_enqueue(esp_mqtt_client_handle_t client, const char *topic, const char *data, int len, int qos, int retain, bool store)
Re: Is ESP-IDF MQTT implementation asynchronous?
An ESP-IDF MQTT asynchronous example is available here: https://github.com/K0I05/ESP32-S3_I2C-M ... E_20241030
This application polls BMP280 and SHT40 MEMS sensors over I2C. Samples are queued and transmitted to a MACHBASE instance that resides on a local network. The device connects to the local network over WIFI, synchronizes the system clock through SNTP services, and publishes data to the MACHBASE MQTT broker at a 6-second interval.
This application polls BMP280 and SHT40 MEMS sensors over I2C. Samples are queued and transmitted to a MACHBASE instance that resides on a local network. The device connects to the local network over WIFI, synchronizes the system clock through SNTP services, and publishes data to the MACHBASE MQTT broker at a 6-second interval.
Who is online
Users browsing this forum: No registered users and 73 guests