PAHO_CS_PUB(1L)

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

πŸ’– PAHO_CS_PUB πŸ’–

okay bestie, welcome to the paho_cs_pub page β€” it lives in section 1L of the manual, and it's literally your group chat for the internet, but make it MQTT. sit down, hydrate, let's go 🫢


✨ NAME ✨

paho_cs_pub β€” send (publish) data to an MQTT server. yes, that's the whole job. iconic behavior honestly πŸ’…


🌸 SYNOPSIS 🌸

paho_cs_pub [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]

that's a LOT of flags and yes, we're doing every single one of them. no skimming. not on my watch πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

paho_cs_pub sends data to an MQTT server, and it does it using the Eclipse Paho C client synchronous library β€” that's MQTTClient to its friends. so like, MQTT is a protocol that runs over TCP/IP, and its whole thing is letting programs talk to each other super easily through a server. messages get published to topics, and then delivered to literally anyone subscribed to those topics. and the matching subscriber program, paho_cs_sub, is the one that receives those MQTT messages. they're a duo. soulmates, fr fr 🫢

the default mode of operation? it reads input from stdin and sends a separate message for every single line it reads. but bestie, options exist to switch that mode up entirely β€” you can send a one-off message instead: a 0-length one (-n), a given string (-m), or the contents of a file (-f). choose your fighter πŸ’…


πŸ‘‘ OPTIONS πŸ‘‘

  • -t, --topic β€” the MQTT topic you're publishing the data to. that's the destination, the address, the where-it-goes ✨
  • -c, --connection β€” the MQTT URI to connect to, aka a combo of transport prefix, host, port, and for websockets, the topic. want TCP? use the tcp prefix, like: tcp://localhost:1883. SSL/TLS? ssl://localhost:1883. websockets, insecure: ws://localhost:1883/topic, and secure: wss://localhost:80/topic. pick your vibe 🌈
  • -h, --host β€” the TCP/IP host name of the MQTT server you're connecting to. paired up with the --port option, this is the older alternative to using --connection. retro but valid πŸ’œ
  • -p, --port β€” the TCP/IP port number of the MQTT server you're connecting to. along with the --host option, it's the older alternative to --connection. same era, same energy πŸŽ€
  • -q, --qos β€” the MQTT QoS you're publishing the message on. your choices are 0, 1 or 2. three flavors, no in-between πŸ’…
  • -V, --MQTTversion β€” which version of the MQTT protocol to use. valid options are 31 (or mqttv31), 311 (mqttv311) and 5 (or mqttv5). and heads up bestie β€” if you go with MQTT version 5, some extra options become valid, like --message-expiry and --user-property. glow up unlocked ✨
  • --quiet β€” do not print error messages. silence. peaceful. serenity πŸ™ˆ
  • --trace β€” print the library internal trace. valid levels are min, max, error and protocol. it's giving "let me see EVERYTHING" πŸ”
  • -r, --retained β€” publish messages with the MQTT retained flag set. it sticks around πŸ‘‘
  • -n, --null-message β€” publish a 0-length message. nothing. emptiness. still a message tho πŸ’€
  • -m, --message β€” publish a one off message with the payload supplied. just hand it the string, done πŸ’–
  • -f, --filename β€” publish a one off message with the contents of the file whose name is given. file to message pipeline, slay πŸ“βœ¨
  • --message-expiry β€” [MQTT version 5 only] sets the expiry interval property of messages, in seconds. it has a shelf life, bestie ⏳
  • --user-property β€” [MQTT version 5 only] sets a user property of sent messages. it takes a pair of strings: name and value 🏷️
  • --will-topic β€” sets the MQTT will message topic to publish to. and here's the drama: if the application ends without sending an MQTT disconnect, the will message gets published to this topic. it's your final message from beyond 😭
  • --will-payload β€” only used if will-topic is set. sets the MQTT will message to be published. the actual words of the will πŸ“œ
  • --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. it lingers πŸ’œ
  • --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. bold choice, bestie, live your truth but know what you're doing ⚠️

ngl there are a few flags chilling in the SYNOPSIS that this page doesn't give their own little paragraph β€” like -i/--clientid, -u/--username, -P/--password, -k/--keepalive, --delimiter, --maxdatalen and --verbose. they're real, they're up there, iykyk 🫢

that's the whole page, no cap. every flag, every default, every TLS-only caveat, every MQTT-version-5 exclusive β€” all present and accounted for πŸ’–

this little masterpiece comes from http://eclipse.org/paho, dated 31 July 2018 at version (v1.3.0), and it's filed under PAHO_CS_PUB(1L). periodt. go publish something iconic πŸŒŸπŸ’…πŸ¦‹