EFWob / ESPPubSubClientWrapper

MIT License
5 stars 0 forks source link

MQTT Authentication #2

Closed radimsejk closed 1 year ago

radimsejk commented 1 year ago

Your library looks good, but sadly I cannot use it because of missing method to set user and password for MQTT authentication. Could you please add it?

EFWob commented 1 year ago

Did you use the connect() method? Namely: connect(const char id, const char user, const char* pass);

Assume you have defined as in the example:

ESPPubSubClientWrapper client(mqtt_server);

then within setup(), before the first call to client.loop(), add the following:

client.connect("MyClientName", "user", "password");

The first parameter ("MyClientName") is the id by which the client gets registered by the MQTT-Broker. Can be any random id.

"user" and "password" need to be changed to your MQTT credentials.

This should do the trick I hope...

radimsejk commented 1 year ago

Thank you for your advice. I do not know why tried to input user and pass to the object declaration.