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

Create single MQTT instance at application start-up #45

Open
jmrubillon opened this issue Nov 27, 2018 · 4 comments
Open

Create single MQTT instance at application start-up #45

jmrubillon opened this issue Nov 27, 2018 · 4 comments

Comments

@jmrubillon
Copy link

I'm not entriely sure how this could be done correctly but maybe using the userdata parameter in the on_connect call could be a mechanism whereby one sets an instance counter when the on_connect callback is triggered and decrements it in the on_disconnect?

Are there any different suggestions? This is just an initial thought after looking at an example in the paho-mqtt repository.

@stlehmann
Copy link
Owner

@jmrubillon Does this refer to the fact that one can use multiple instances of flask but should not use multiple mqtt clients?

@jmrubillon
Copy link
Author

@stlehmann To be quite honest I can't quite remember the context in which I made that particular comment.
I believe it's something to do with multiple instances of Flask should only use the one mqtt client. Now since I can't remember why I made that particular suggestion, I probably had found an alternative way of dealing with it.

@stlehmann
Copy link
Owner

@jmrubillon Thanks for the feedback. Multiple instances of flask using one single mqtt client would be a nice feature to have. I was thinking about it before but didn't figure out a way to deal with this nicely. I will leave this issue open because maybe someone comes along with a great solution 🤞

@Niraj-Kamdar
Copy link

What will be the problem if I use multiple instances of Flask with multiple instances of MQTT client?

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

No branches or pull requests

3 participants