| Home | Libraries | People | FAQ | More

##### boost::mqtt5::mqtt_client::credentials

Assign credentials that will be used to connect to a Broker.

###### Synopsis

    boost::mqtt5::mqtt_client&
    credentials(
        std::string client_id,
        std::string username = "",
        std::string password = "");

###### Description

Credentials consist of a unique Client Identifier and, optionally, a User Name and Password.

###### Attention

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.