mqtt-simple - Very simple MQTT implementation
mqtt-simple -h mqtt.example.org -c -s "sensors/#" -s "debug/#" -s "#" mqtt-simple -h mqtt.example.org -p "example/unretained" -m "message" mqtt-simple -h mqtt.example.org -r -p "example/retained" -m "message" tail -f logfile | mqtt-simple -h mqtt.example.org -p "log/example" mqtt-simple --ssl --insecure ... mqtt-simple --ssl --ca ca.crt --cert client.crt --key client.key
This is just a simple utility program. It doesn't do much. Specifically, all the QoS features are unsupported. Also, don't expect fancy error messages and such :-)
MQTT server to connect to, required.
Publish a message. Uses the message given with -m, or will read lines from stdin, and publish a message for each given line.
-m
Message to publish. Requires -p.
-p
Causes messages published with -p to have the "retain" flag on.
Subscribe to the given topic filter. Use the standard MQTT wildcards like + and #. Outputs matching published messages on stdout. Can be given multiple times.
+
#
Suppress published messages that match filter. Can be given multiple times.
Quit after receiving number messages.
Output only the message values, without the topics.
Shortcut for --count 1 --message-only.
--count 1 --message-only
For each given -s, print the matching topic in a different color. Note that the first matching topic will be used for color selection, so specify the topics with the most specific one first, the least specific one (like #) last.
-s
Color is enabled by default if stdout is a terminal.
Pass ASCII control characters unaltered. By default, they're replaced by ^@ notation or, when --color is enabled, reverse video characters. For example, an ASCII newline would be displayed as ^J unless --raw is used.
^@
--color
^J
--raw
Prefix messages with a timestamp. Optionally, a format for strftime can be supplied.
strftime
Specify a username. Overrides the environment variable MQTT_SIMPLE_USERNAME.
MQTT_SIMPLE_USERNAME
Specify a password. Overrides the environment variable MQTT_SIMPLE_PASSWORD.
MQTT_SIMPLE_PASSWORD
Use SSL instead of unencrypted connection.
Disable SSL certificate validation and enable clear text passwords. Useful for testing, bad idea in production.
Overrides the environment variables MQTT_SIMPLE_SSL_INSECURE and MQTT_SIMPLE_ALLOW_INSECURE_LOGIN.
MQTT_SIMPLE_SSL_INSECURE
MQTT_SIMPLE_ALLOW_INSECURE_LOGIN
The Certificate Authority to validate against. path can be a file or a directory. If unspecified, IO::Socket::SSL attempts to use the system wide CA configuration.
Overrides the environment variable MQTT_SIMPLE_SSL_CA.
MQTT_SIMPLE_SSL_CA
A client certificate with its key.
Override the environment variables MQTT_SIMPLE_SSL_CERT and MQTT_SIMPLE_SSL_KEY.
MQTT_SIMPLE_SSL_CERT
MQTT_SIMPLE_SSL_KEY
Pick your favourite OSI approved license :)
http://www.opensource.org/licenses/alphabetical
Juerd Waalboer <juerd@tnx.nl>
Net::MQTT::Simple
To install Net::MQTT::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::MQTT::Simple
CPAN shell
perl -MCPAN -e shell install Net::MQTT::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.