Skip to content

set clientID #301

@MehdiSadeghii

Description

@MehdiSadeghii

after setting client ID, ESP32 tries to connect as anonymous user.

here is the code where I set my connection credentials.

mqttClient.setServer(const_cast <char*>(configurations.brokerAddress.c_str()), configurations.brokerPort);
mqttClient.setCredentials(const_cast<char*>(configurations.brokerUser.c_str()), const_cast<char*>(configurations.brokerPassword.c_str()));

String clientID = WiFi.macAddress();
clientID = clientID + generateRandomString(10);

mqttClient.setClientId(const_cast<char*>(clientID.c_str()));
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions