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

Is it possible to connect to two MQTT brokers at the same time with this library? #40

Open
edautz opened this issue Dec 4, 2015 · 4 comments

Comments

@edautz
Copy link

edautz commented Dec 4, 2015

From a friend i got an ESP sketch to get P1 readings form an powermeter and send them to an Mosquitto MQTT broker.

It works well.

I try to change the sketch so i can connect to two Mosquitto MQTT brokers at the same time, but I endup in a connection loop when using the client1.loop(); and client2.loop() statements.

Does this library support using two clients simultaniously?

@Imroy
Copy link
Owner

Imroy commented Dec 5, 2015

Well it's not been tested doing that. But everything is nicely encapsulated and there are no global variables, so it shouldn't be a problem.

How are you calling client1.loop() and client2.loop(), and just what is this "connection loop"?

@edautz
Copy link
Author

edautz commented Dec 5, 2015

After publish some data to the MQTT broker, the sketch calls client1.loop() or client2.loop().

While calling it, it generates lots of connections to the broker.

I can send the sketch if this helps.

@matbor
Copy link

matbor commented Dec 6, 2015

As a work around, if you not aware, you can setup one of your brokers in bridge mode so that you can publish the information to the second broker. http://mosquitto.org/man/mosquitto-conf-5.html

@edautz
Copy link
Author

edautz commented Dec 7, 2015

I am aware of that solution, but I got two seperate MQTT brokers and two seperate homedomotica systems for redundancy and testing purposes. I want to keep my setup this way.

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