![]() |
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 takes action when the client is in a non-operational state,
meaning the async_run
function has not been
invoked. Furthermore, you can use this function after the cancel
function has been called,
before the async_run
function is invoked
again.
Some valid hosts
string:
std::string valid_hosts_1 = "broker1:1883, broker2, broker3:1883"; std::string valid_hosts_2 = "broker1";