fredilarsen / ReconnectingMqttClient

Portable simple header-only C++ MQTT client for WIndows, Linux, Arduino, Raspberry, ESP8266, ESP32++
Apache License 2.0
20 stars 5 forks source link

Can it be used with broker requiring credentials #3

Open Strooom opened 2 years ago

Strooom commented 2 years ago

Hi Fred,

I am considering using your library in order to build a test-bench for integration testing : the PC application would inject msgs towards devices under test, and listen for their responses. Our broker requires to connect with username and password. I see those appearing in the source code but I am not sure how to use them. Can you provide a small example with username and password ?

Tnx!

fredilarsen commented 2 years ago

@Strooom I will add a setter for user name and password.

Until I get this added and tested, you can try to set the user and password data members after constructing the object but before using it. Please report back whether it is working or not.

ReconnectingMqttClient client(ip, 1883, "simpleclient");
client.user = "user1";
client.password = "password1";
...