micropython-mqtt icon indicating copy to clipboard operation
micropython-mqtt copied to clipboard

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

Open oaux opened this issue 1 year ago • 3 comments

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

oaux avatar Jun 02 '23 10:06 oaux

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.

peterhinch avatar Jun 05 '23 08:06 peterhinch

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

oaux avatar Jun 05 '23 09:06 oaux

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.

peterhinch avatar Jun 05 '23 17:06 peterhinch