Skip to content

Esp32 How to use mqtt_ As to connect the brokers of two servers? #113

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

Open
oaux opened this issue Jun 2, 2023 · 3 comments
Open

Esp32 How to use mqtt_ As to connect the brokers of two servers? #113

oaux opened this issue Jun 2, 2023 · 3 comments

Comments

@oaux
Copy link

oaux commented Jun 2, 2023

I tried to create two MQTTclients, but many wifi error prompts

@peterhinch
Copy link
Owner

I don't think this can work. You would have two sockets (one on each client) connected to the same port. There is no mechanism for determining the correct destination socket for an incoming packet. You might be able to do something if you could ensure that the two brokers used different ports.

@oaux
Copy link
Author

oaux commented Jun 5, 2023

If two brokers use different ports, how to handle it? I tried to hide the WiFi reconnection code, but it would cause the two links to switch repeatedly

@peterhinch
Copy link
Owner

Good point. I think it would involve a lot of work. The module was designed on the basis of a one-to-one correspondence between client and broker.

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