PAHO_C_SUB_STATIC(1L)
π PAHO_C_SUB_STATIC π
okay bestie, welcome to paho_c_sub_static, which lives in section 1L of the manual. She's the little sister program that sits there and receives stuff. Grab a strawberry π, we're doing MQTT.
β¨ NAME β¨
paho_c_sub_static β receive (subscribe to) data from an MQTT server π«Ά
πΈ SYNOPSIS πΈ
paho_c_sub_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|--no-retained] [--delimiter delimiter] [--no-
delimiter]
[--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]
no cap, that's the whole vibe in one block π¦
π DESCRIPTION π
So paho_c_sub_static receives data from an MQTT server, and it does it using the Eclipse Paho C client asynchronous library (MQTTAsync). It's giving main character energy but make it a listener. π
Now, MQTT? It's a protocol, bestie. It runs on top of TCP/IP, and it lets programs talk to each other sooo easily through a server. Messages get published to topics, and then they get delivered to anyone who subscribed to those topics. That's it, that's the whole thing. And if you ever wanna be the one sending instead of receiving, the matching publisher program paho_c_pub is right there for you. π
The default mode of operation β the default vibe, if you will β is to output each message to stdout, terminated by the delimiter. Every message, straight to your screen. iconic. β¨
π OPTIONS π
okay this is the long part, but stay with me, every single one matters π«Ά
-t,--topicβ the MQTT topic to publish the data to. (yes, she says "publish" here, we are simply quoting the queen π)-c,--connectionβ the MQTT URI to connect to: a combo of transport prefix, host, port, and for websockets, a topic. Wanna go TCP? Use thetcpprefix, liketcp://localhost:1883. SSL/TLS girlie?ssl://localhost:1883. Websockets, insecure:ws://localhost:1883/topic, and secure:wss://localhost:80/topic. pick your fighter π-h,--hostβ the TCP/IP host name of the MQTT server you're connecting to. Together with the--portoption, this is the older alternative to using--connection. vintage, but valid π-p,--portβ the TCP/IP port number of the MQTT server you're connecting to. Together with the--hostoption, also an older alternative to--connection. matching set π-q,--qosβ the MQTT QoS on which to publish the message. The alternatives are0,1or2.-V,--MQTTversionβ the version of the MQTT protocol to use. Valid options are31(ormqttv31),311(mqttv311) and5(ormqttv5). choose your era β¨--quietβ do not print error messages. silence, but make it on purpose π€«--traceβ print library internal trace. Valid levels aremin,max,errorandprotocol. she's showing you her diary π-R,--no-retainedβ do not print messages which have the MQTT retained flag set. we're skipping the leftovers π«--delimiterβ the delimiter string to append to each message when printing. Defaults to newline.--no-delimiterβ do not add a delimiter to each message when printing. feral. no separator. chaos. π--will-topicβ sets the MQTT will message topic to publish to. If the application ends without sending an MQTT disconnect, the will message will be published to this topic. it's giving last words π--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. show them your papers, bestie πͺͺ--keyβ only used with a TLS connection. The name of a file containing the client private key. guard her with your life π--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. flex your suite list π--insecureβ only used with a TLS connection. Don't check that the server certificate common name matches the hostname.
β οΈ heads up bestie: --insecure literally turns OFF a security check. It's right there in the name. use with intention, not by accident. π¨
π¦ SEE ALSO π¦
go give these girlies a visit, they're all family:
paho_c_pub(1)paho_c_pub_static(1)paho_c_sub(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 icon of a document came to you from http://eclipse.org/paho, dated 31 December 2020 and living at version v1.3.8 β from your girl PAHO_C_SUB_STATIC(1L), signing off π subscribe responsibly, mwah π
π¦ 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