Skip to content

Commit 03759eb

Browse files
committed
set_auth for nmqtt_pub
1 parent c180eee commit 03759eb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/nmqtt_pub.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ proc nmqttPub(host="127.0.0.1", port: int=1883, ssl:bool=false, clientid="", use
99
let ctx = newMqttCtx(if clientid != "": clientid else: "nmqtt_pub_" & $getCurrentProcessId())
1010
ctx.set_host(host, port, ssl)
1111

12+
if username != "" or password != "":
13+
ctx.set_auth(username, password)
14+
1215
# Set the will message
1316
if willretain and (willtopic == "" or willmsg == ""):
1417
echo "Error: Will-retain giving, but no topic given"

0 commit comments

Comments
 (0)