Hi,
I'm looking at porting an mqtt client implementation from IDFv4 to IDFv5, but I've run into what seems to be a big issue.
Previously*, it was possible to set a "user context" pointer when initialising the client, and that pointer would then be handed back in each event. This followed the typical pattern for event driven libraries in C, where the caller is free to associate whatever context with a session and have it accessible at the time of handling the event.
In IDFv5**, I cannot find any support for this. Is it really intentional that such a fundamental aspect of the library has been changed/removed? I'm looking at a significant rewrite of the client code here if that's the case. By the looks of it I would have to establish and maintain an external esp_mqtt_client_handle_t to user context data structure in order to achieve what the old `user_context` field did. Obviously, I'd prefer to not have to do that.
Thanks in advance.
*) See https://docs.espressif.com/projects/esp ... parameters
**) See https://docs.espressif.com/projects/esp ... figuration
MQTT in IDFv5 - where is user_context?
Re: MQTT in IDFv5 - where is user_context?
For anyone else running into this issue, as pointed out to me on the github issue*, what has happened is that the mqtt library has moved its event notifications from its own callbacks over to regular esp_event notifications. So, the functionality still exists, but is now via esp_event.
*) https://github.com/espressif/esp-idf/issues/10644
*) https://github.com/espressif/esp-idf/issues/10644
Who is online
Users browsing this forum: No registered users and 246 guests