PAHO_C_PUB_STATIC(1L)

πŸ“¦
version 1.3.16 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ¦‹ NAME πŸ¦‹

okay so bestie, meet paho_c_pub_static β€” she sends (publishes) data to an MQTT server. that's it, that's the job, and she eats every time πŸ’…

(this page lives in section 1L of the manual, if you were wondering where to find her 🫢)


✨ SYNOPSIS ✨

paho_c_pub_static [topic] [-t|--topic topic] [-c|--connection
connection] [-h|--host hostname] [-p|--port portnumber] [-i|--clientid
clientid] [-u|--username username] [-P|--password password]
[-k|--keepalive keepalive-timeout] [-V|--MQTT-version 31|311|5]
[-q|--qos 0|1|2] [-r|--retained] [-n|--null-message] [-m|--message
message] [-f|--filename filename] [--delimiter delimiter] [--maxdatalen
maxdatalen]
[--message-expiry expiry-interval] [--user-property name value]
[--quiet] [--verbose] [--trace min|max|error|protocol]
[--will-topic will-topic] [--will-payload will-payload] [--will-retain]
[--will-qos 0|1|2]
[--cafile cafile] [--capath capath] [--cert certfile] [--key keyfile]
[--keypass password] [--ciphers cipher-string] [--insecure]

🌸 DESCRIPTION 🌸

paho_c_pub_static sends data to an MQTT server, and it does it with the Eclipse Paho C client asynchronous library (MQTTAsync). and like… MQTT is a protocol, right? it runs over TCP/IP, and it lets programs just chat with each other through a server, no drama. messages get published to topics and then delivered to whoever subscribed to those topics. her matching bestie paho_c_sub is the one that receives MQTT messages, so they're literally a duo, it's giving destiny πŸ”₯

so the default mode is: she reads input from stdin and sends a separate message for every single line she reads. very demure, very consistent. but there are options to switch the whole vibe up into a one-off message instead:

  • a message of 0 length (-n)
  • a message that's a given string (-m)
  • a message that's the contents of a file (-f)

pick your fighter πŸ’…


πŸ‘‘ OPTIONS πŸ‘‘

  • -t, --topic β€” the MQTT topic you're publishing the data to. this is the whole destination, bestie.
  • -c, --connection β€” the MQTT URI you're connecting to. it's a combo of transport prefix, host, port, and for websockets, the topic. using TCP? prefix it with tcp, like: tcp://localhost:1883. doing SSL/TLS? ssl://localhost:1883. websockets, insecure: ws://localhost:1883/topic, and secure: wss://localhost:80/topic. 🌈
  • -h, --host β€” the TCP/IP host name of the MQTT server you're connecting to. paired with the --port option, this is the older alternative to using --connection.
  • -p, --port β€” the TCP/IP port number of the MQTT server. paired with the --host option, this is the older alternative to using --connection.
  • -q, --qos β€” the MQTT QoS you're publishing the message on. your choices are 0, 1 or 2. that's the whole menu πŸ“
  • -V, --MQTTversion β€” the version of the MQTT protocol to use. valid options are 31 (or mqttv31), 311 (mqttv311) and 5 (or mqttv5). oh and if you're on MQTT version 5, some extra options become valid, like --message-expiry and --user-property. glow-up privileges ✨
(little heads-up: the synopsis writes this one as -V|--MQTT-version 31|311|5, but the option itself is listed here as -V / --MQTTversion β€” same queen, two name tags.)
  • --quiet β€” do not print error messages. silence, but make it intentional πŸ™ˆ
  • --trace β€” print library internal trace. valid levels are min, max, error and protocol. for when you simply must know everything πŸ”
  • -r, --retained β€” publish messages with the MQTT retained flag set.
  • -n, --null-message β€” publish a 0-length message.
  • -m, --message β€” publish a one off message with the payload supplied.
  • -f, --filename β€” publish a one off message with the contents of the file whose name is given.
  • --message-expiry β€” [MQTT version 5 only] sets the expiry interval property of messages, in seconds. ⏳
  • --user-property β€” [MQTT version 5 only] sets a user property of sent messages. it's a pair of strings, name and value.
  • --will-topic β€” sets the MQTT will message topic to publish to. if the application ends without sending an MQTT disconnect, the will message gets published to this topic. dramatic exit, iconic πŸ’€
  • --will-payload β€” only used if will-topic is set. sets the MQTT will message to be published.
  • --will-qos β€” only used if will-topic is set. sets the MQTT QoS at which the will message is published. the alternatives are 0, 1 or 2.
  • --will-retain β€” only used if will-topic is set. sets the MQTT retained flag on the will message.
  • --cafile β€” only used with a TLS connection. the name of a file for the OpenSSL trust store. πŸ”
  • --capath β€” only used with a TLS connection. the name of a directory holding OpenSSL trusted certificates.
  • --cert β€” only used with a TLS connection. the name of a file for the TLS keystore containing a client certificate to be presented.
  • --key β€” only used with a TLS connection. the name of a file containing the client private key.
  • --keypass β€” only used with a TLS connection. the password for the client private key file, if needed.
  • --ciphers β€” only used with a TLS connection. a list of cipher suites that the client will present to the server during the TLS handshake.
  • --insecure β€” only used with a TLS connection. don't check that the server certificate common name matches the hostname.
⚠️ okay real talk: --insecure means the server cert common name is not checked against the hostname. it's literally named that for a reason, bestie. know what you're doing before you flex it.

πŸ”— SEE ALSO πŸ”—


and that's the whole page, bestie πŸŽ€ this one comes to you from http://eclipse.org/paho, dated 31 December 2020 (v1.3.8), hanging out in section 1L as PAHO_C_PUB_STATIC(1L). go publish something iconic, you've got this πŸ’œβœ¨