espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
610 stars 257 forks source link

esp-mqtt subscribe and retained messages #64

Closed PaulVdBergh closed 5 years ago

PaulVdBergh commented 6 years ago

Please have a look at my question at esp32.com

Thanks, Paul.

david-cermak commented 6 years ago

Hi Paul,

related to the line if (client->mqtt_state.message_length_read >= client->mqtt_state.message_length):

Can you please check if your issue persists when switching to the latest IDF? (no need to add esp-mqtt)?

Thank you, David

PaulBreugnot commented 5 years ago

Hi everybody,

I have the same issue, even with IDFv3.3. Maybe the difference is that I subscribe calling the esp_mqtt_client_subscribe function individually for each topic, so, as a workaround, what I do is that I use esp_mqtt_client_config_t's user_context with boolean variables, and, basically :

It requires more code and I have to handle the case when there is no retained message in the first topic (otherwise, I will never subscribe to the second topic), but at least it works. ;-)

Paul

david-cermak commented 5 years ago

Resolved in these commits: https://github.com/espressif/esp-mqtt/commit/db64b791205c8dbcd0f3826a9544f0aa0301baaf https://github.com/espressif/esp-mqtt/commit/cf5b8eda89057f5eb49654d2eaf4d1a209af2d11 https://github.com/espressif/esp-mqtt/commit/d4b66556186141e09db89c57781c6709e0e71d8a