NAME

mqtt-multipub - Publish multiple MQTT messages at once

SYNOPSIS

mqtt-multipub -h|--host hostname [publish] topic=value ... [retain] topic=value ...

VERSION

version 0.01

DESCRIPTION

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.

ARGUMENTS

publish

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.

retain

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.

topic=value

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.

OPTIONS

-h|--host hostname

Connect to hostname. Mandatory.

-V|--version

Print mqtt-multipub version.

EXIT STATUS

Zero unless things went wrong.

CONFIGURATION

None.

DEPENDENCIES

* File::Slurp
* Net::MQTT::Simple

BUGS AND LIMITATIONS

Probably many.

AUTHOR

Copyright (C) 2017 by Daniel Friesel <derf@finalrewind.org>

LICENSE

This software is licensed under the same terms as Perl itself.