@@ -9,6 +9,7 @@ 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+ # Set the will message
1213 if willretain and (willtopic == " " or willmsg == " " ):
1314 echo " Error: Will-retain giving, but no topic given"
1415 quit ()
@@ -51,22 +52,22 @@ $options
5152 doc= " Publish MQTT messages to a MQTT-broker." ,
5253 cmdName= " nmqtt_pub" ,
5354 help= {
54- " host" : " IP-address of the broker." ,
55- " port" : " network port to connect too." ,
56- " ssl" : " enable ssl. Auto-enabled on port 8883." ,
57- " clientid" : " your connection ID. Defaults to nmqtt_pub_ appended with processID." ,
58- " username" : " provide a username" ,
59- " password" : " provide a password" ,
60- " topic" : " mqtt topic to publish to." ,
61- " msg" : " message payload to send." ,
62- " qos" : " quality of service level to use for all messages." ,
63- " retain" : " retain messages on the broker." ,
64- " repeat" : " repeat the publish N times." ,
65- " repeatdelay" :" if using --repeat, wait N seconds between publish. Defaults to 0." ,
66- " willtopic" :" set the will's topic" ,
67- " willmsg" : " set the will's message" ,
68- " willqos" : " set the will's quality of service" ,
69- " willretain" :" set to retain the will message"
55+ " host" : " IP-address of the broker." ,
56+ " port" : " network port to connect too." ,
57+ " ssl" : " enable ssl. Auto-enabled on port 8883." ,
58+ " clientid" : " your connection ID. Defaults to nmqtt_pub_ appended with processID." ,
59+ " username" : " provide a username" ,
60+ " password" : " provide a password" ,
61+ " topic" : " mqtt topic to publish to." ,
62+ " msg" : " message payload to send." ,
63+ " qos" : " quality of service level to use for all messages." ,
64+ " retain" : " retain messages on the broker." ,
65+ " repeat" : " repeat the publish N times." ,
66+ " repeatdelay" : " if using --repeat, wait N seconds between publish. Defaults to 0." ,
67+ " willtopic" : " set the will's topic" ,
68+ " willmsg" : " set the will's message" ,
69+ " willqos" : " set the will's quality of service" ,
70+ " willretain" : " set to retain the will message"
7071 },
7172 short= {
7273 " password" : 'P' ,
0 commit comments