mqttui-publish(1)

πŸ“¦ version 0.24.0, in arch rolling

πŸ’… mqttui-publish β€” like, the quickest way to yeet a value onto a topic

Okay bestie, so this is mqttui-publish(1), part of the General Commands Manual (very official, very demure), and it does exactly one thing: publish a value quickly. That's the whole vibe. Iconic, honestly.


✨ SYNOPSIS ✨

mqttui publish [-r|--retain] [-v|--verbose] [--qos] [-b|--broker]
[-u|--username] [--password] [-i|--client-id] [--ca-cert]
[--client-cert] [--client-private-key] [--insecure] [-h|--help] <TOPIC>
[PAYLOAD]

Like, that's the shape of the command. mqttui publish, then your lil flags, then the topic, then optionally the payload. Slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

Publish a value quickly.

That's it. That's the whole description. It's giving short-and-sweet main character energy β€” no paragraphs of lore, just "go publish ur thing". Obsessed.


πŸŽ€ OPTIONS πŸŽ€

  • -r, --retain β€” publishes the MQTT message retained, so the broker hangs onto it for whoever shows up later. You can also set this with the MQTTUI_RETAIN environment variable instead of typing the flag, iykyk.
  • -v, --verbose β€” shows you the full MQTT communication. Not a summary, not a vibe check β€” the whole conversation. Perfect for when you're like "why is nothing working 😭".
  • --qos <LEVEL> β€” [default: 2] the maximum Quality of Service (QoS) for subscriptions and publishing.

Okay so this one needs a sec, bestie. The lower Quality of Service level between publisher and subscriber is what actually gets delivered from broker to subscriber. So like:

  • subscribing with 0 will never receive a 1 or 2
  • publishing with 2 will be received as 1 when subscribed with 1

And the levels themselves:

  • 0: at most once (fire and forget) πŸ”₯
  • 1: at least once (acknowledged delivery with potential duplicates) πŸ™ˆ
  • 2: exactly once (assured delivery without duplicates) πŸ‘‘

You can also set this with the MQTTUI_QOS environment variable.

  • -h, --help β€” prints help. Note the tea β˜•: it says (see a summary with '-h') β€” so the help you get here is the full-length director's cut, and -h gives you the trailer.
  • <TOPIC> β€” the topic you're publishing to. Your destination. Your moment.
  • [PAYLOAD] β€” the payload to be published.

And here's the cute part: reads from stdin when not specified. So you can yeet file contents through a pipe like this (bash):

`mqttui publish some/topic </etc/hostname`

`cowsay "I was here" | mqttui publish some/topic`

Yes, that second one is a cow saying "I was here" and then it gets published to MQTT. That's the dream, honestly. πŸ„


🌈 MQTT CONNECTION 🌈

  • -b, --broker <URL> β€” [default: mqtt://localhost] the URL that represents how to connect to the MQTT broker.

Examples, so you know the range:

  • mqtt://localhost
  • mqtt://localhost:1883
  • mqtts://localhost
  • mqtts://localhost:8883
  • ws://localhost/path
  • ws://localhost:9001/path
  • wss://localhost/path
  • wss://localhost:9001/path

You can also set this with the MQTTUI_BROKER environment variable.

  • -u, --username <STRING> β€” username to access the mqtt broker. If you don't supply one, it's anonymous access. No username, no problem. You can also set this with the MQTTUI_USERNAME environment variable.
  • --password <STRING> β€” password to access the mqtt broker.
⚠️ Bestie, listen to me: consider using a connection with TLS to the broker. Otherwise the password will be transported in plaintext. That's not a vibe. πŸ’€
πŸ”₯ Also: passing the password via command line is insecure because the password can be read from the history! You should pass it via environment variable instead. Like, pls.

You can also set this with the MQTTUI_PASSWORD environment variable.

  • -i, --client-id <STRING> β€” specify the client id to connect with. You can also set this with the MQTTUI_CLIENTID environment variable (yes, no underscore between "client" and "id" β€” copy it exactly, bestie 🫢).
  • --ca-cert <FILEPATH> β€” path to a trusted CA certificate PEM file for verifying the broker.

Little caveat: the CA certificate has to be an X.509 v3 certificate, because rustls does not support the less secure v1 certificates. See: <https://github.com/rustls/rustls/issues/2364>

You can also set this with the MQTTUI_CA_CERTIFICATE environment variable.

  • --client-cert <FILEPATH> β€” path to the TLS client certificate file.

It's used together with --client-private-key to enable TLS client authentication. The file has to be a DER-encoded X.509 certificate serialized to PEM. You can also set this with the MQTTUI_CLIENT_CERTIFICATE environment variable.

  • --client-private-key <FILEPATH> β€” path to the TLS client private key file.

Used together with --client-cert to enable TLS client authentication. The file has to be a DER-encoded ASN.1 file in PKCS#8 form serialized to PEM. You can also set this with the MQTTUI_CLIENT_PRIVATE_KEY environment variable.

  • --insecure β€” allow insecure TLS connections. πŸ™ˆ You've been warned, and also, it's literally in the name.

And that's the whole page, bestie. πŸŽ€ This lil gem comes from the mqttui-publish(1) manual, part of the mqttui source/version, dated with that official manual-page date β€” mwah, go publish something iconic. πŸ’–βœ¨

πŸ“¦ where this page comes from