My MQTT server requires user name and password for connection. For example,
mosquitto_sub -t '#' -u 'username' -P 'password'
I am unable to see any username/password in the examples and the source code. Wonder if anyone can give me some help.
Thanks,
Jingzhao
You can pass username and password to mqtt.connect, as they are part of the CONNECT packet. I will leave this open, and it is probably worth to add them to the README.
Would you like to send a PR?
I tested the following options.
client = mqtt.connect({
host: 'www.example.com',
port: 1883,
username: 'username',
password: 'password'
});
Things work properly.
Already submitted a PR.
Thanks!
Most helpful comment
I tested the following options.
Things work properly.