![]() |
Home | Libraries | People | FAQ | More |
Assign a list of Brokers that the Client will attempt to connect to.
boost::mqtt5::mqtt_client&
brokers(
std::string hosts,
uint16_t default_port = 1883);
The Client will cycle through the list of hosts, attempting to establish a connection with each until it successfully establishes a connection.
|
Name |
Description |
|---|---|
|
|
List of Broker addresses and ports. Address and ports are separated
with a colon |
|
|
The default port to connect to in case the port is not explicitly
specified in the |
This function has no effect while the Client is running. Call it before
async_run, or after cancel or async_disconnect and before invoking
async_run again.
Some valid hosts string:
std::string valid_hosts_1 = "broker1:1883, broker2, broker3:1883"; std::string valid_hosts_2 = "broker1";