PAHO_C_PUB_STATIC(1L)
π¦ 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 withtcp, 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--portoption, this is the older alternative to using--connection.-p,--portβ the TCP/IP port number of the MQTT server. paired with the--hostoption, this is the older alternative to using--connection.-q,--qosβ the MQTT QoS you're publishing the message on. your choices are0,1or2. that's the whole menu π-V,--MQTTversionβ the version of the MQTT protocol to use. valid options are31(ormqttv31),311(mqttv311) and5(ormqttv5). oh and if you're on MQTT version 5, some extra options become valid, like--message-expiryand--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 aremin,max,errorandprotocol. 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,nameandvalue.--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 ifwill-topicis set. sets the MQTT will message to be published.--will-qosβ only used ifwill-topicis set. sets the MQTT QoS at which the will message is published. the alternatives are0,1or2.--will-retainβ only used ifwill-topicis 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 π
paho_c_pub(1)paho_c_sub(1)paho_c_sub_static(1)paho_cs_pub(1)paho_cs_pub_static(1)paho_cs_sub(1)paho_cs_sub_static(1)
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 πβ¨
π¦ where this page comes from
- debian trixie: paho.mqtt.c-examples 1.3.14-2 Β· EPL-2.0
- ubuntu noble: paho.mqtt.c-examples 1.3.13-1build2 Β· EPL-2.0
- ubuntu questing: paho.mqtt.c-examples 1.3.14-2
- ubuntu resolute: paho.mqtt.c-examples 1.3.15-1 Β· EPL-2.0
- ubuntu stonking: paho.mqtt.c-examples 1.3.16+ds-1build1 Β· EPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms