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

Support multiple instances in parallel #33

Open
jpf91 opened this issue Oct 30, 2021 · 1 comment
Open

Support multiple instances in parallel #33

jpf91 opened this issue Oct 30, 2021 · 1 comment

Comments

@jpf91
Copy link
Contributor

jpf91 commented Oct 30, 2021

Hi,

I'd like to be able to have multiple instances of the esp-mqtt client running in parallel.
Adding this support seems simple enough, as the lwmqtt library and the connection support code here already seems to handle multiple instances just fine. So I likely only need to change esp_mqtt.c.

Before I make those changes in esp_mqtt.c and open a pull request, I'd like to ask for some quick feedback:

  • I guess you want to keep backwards compatibility? So current dunctions should be kept and should probably forward to the new functions, using a single global client instance?
  • How should I name the new functions? Those will mirror the current function API 1:1 but take an additional context argument as first parameter. Just add 2 to the function names?
@256dpi
Copy link
Owner

256dpi commented Nov 1, 2021

Hi, thanks for looking into this! It would be nice to keep the global client API around long-term as mosts projects do not require multiple clients. I would suggest creating a client oriented API in "esp_mqtt_client.{c,h}" and then use this API for implementing the global client. The functions could have the following syntax `esp_mqtt_client_publish(esp_mqtt_client * client, ...).

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

2 participants