Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion writeToStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ function connect (packet, stream, opts) {

// Password
if (password != null) {
if (!providedUsername) {
if (!providedUsername && protocolVersion !== 5) {
// `username` is not required when password is present in MQTT-v5
// see also: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901044
Comment on lines +204 to +205
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this comment above the if for consistency

stream.destroy(new Error('Username is required to use password'))
return false
}
Expand Down