Open PeterCAN opened 6 years ago
Hi @PeterCAN, Once the client has been instantiated, the hostname can no longer be changed. You'll need to create a new client before you can use a new hostname.
One important distinction with this though: if you use the hosts field in the connection options, you can define multiple hosts that the client can cycle through if the host it attempts to connect to / is connected to is no longer available (http://www.eclipse.org/paho/files/jsdoc/Paho.MQTT.Client.html)
Hi All,
I'm writing an web application where I want a single Paho.MQTT.Client to be able to disconnect from a MQTT broker, and connect it to another MQTT broker with a different IP address.
Is this possible?
I've tried myClient._setHost("a.b.c.d"); and that returns 'Unsupported', even after a call to myClient.disconnect().
So do I have to delete my existing Paho.MQTT.Client and create a new one with a different IP address in order to switch between MQTT brokers?