Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp-mqtt subscribe and retained messages #64

Closed
PaulVdBergh opened this issue Aug 25, 2018 · 3 comments
Closed

esp-mqtt subscribe and retained messages #64

PaulVdBergh opened this issue Aug 25, 2018 · 3 comments

Comments

@PaulVdBergh
Copy link

Please have a look at my question at esp32.com

Thanks,
Paul.

@david-cermak
Copy link
Collaborator

Hi Paul,

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

  • it is supposed to process only related part of the data, further data will be processed in the next iteration of publish.
  • Some refactoring were made to this part of the code but at this moment it resides on an idf branch, but will be merged to master once IDFv3.2 is released.

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

Thank you,
David

@PaulBreugnot
Copy link

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 :

  • I subscribe to the first topic.
  • I do nothing until the first retained message is received.
  • I subscribe to the second topic.
  • I receive the second retained message.

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 pushed a commit that referenced this issue Jan 3, 2019
…P packet : iterate over the buffer received.

Merges #82
Closes #64
Closes #80
@david-cermak
Copy link
Collaborator

Resolved in these commits:
db64b79
cf5b8ed
d4b6655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants