multithreadingmqttmosquittopahobroker

Can paho-mqtt client connect to multiple brokers at the same time?


I want my MQTT publisher client to connect to multiple brokers at the same time. The topic is the same in this case, just multiple brokers are involved. Will multithreading be used for such a purpose? or there's some other way out.


Solution

  • No, The client can only connect to a single broker at a time.

    You can run multiple clients.

    But why not just bridge the topics at one of the brokers rather than trying to publish the same data to 2 separate brokers?