mqtt-multipub - Publish multiple MQTT messages at once
mqtt-multipub -h|--host hostname [publish] topic=value ... [retain] topic=value ...
version 0.01
mqtt-multipub publishes multiple MQTT messages (usually for different topics) using a single connection. This makes it faster than a series of mosquitto_pub invocations.
Its non-option arguments consist of the messages to publish and the publish and retain keywords specifying how exactly the messages should be published.
All messages specified after publish will be published without retain flag. I.e., they will be forwarded to clients subscribed to the topic, but they will not be retained for clients subscribing at a later time.
This is the default behaviour.
All messages specified after retain will be published and retained on the MQTT broker as "last known good" value. So, clients which subscribe at a later time will still get the value published this way -- unless it is updated or deleted in the meantime.
Publish (and optionally retain, see above) value as a message for topic.
If value begins with a / (slash), it is interpreted as a filename and the file content published instead. If the file contains a trailing newline character, it will be left out of the message body.
To avoid value being parsed as a filename, prefix it with an additional slash character: Use //... instead of /.... This additional character will not be part of the published message.
Connect to hostname. Mandatory.
Print mqtt-multipub version.
Zero unless things went wrong.
None.
Probably many.
Copyright (C) 2017 by Daniel Friesel <derf@finalrewind.org>
This software is licensed under the same terms as Perl itself.