Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set clientID #301

Open
MehdiSadeghii opened this issue Feb 28, 2024 · 0 comments
Open

set clientID #301

MehdiSadeghii opened this issue Feb 28, 2024 · 0 comments

Comments

@MehdiSadeghii
Copy link

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()));
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant