micropython-mqtt
micropython-mqtt copied to clipboard
Esp32 How to use mqtt_ As to connect the brokers of two servers?
I tried to create two MQTTclients, but many wifi error prompts
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.
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
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.