PAHO_CS_SUB(1L)
π PAHO_CS_SUB β the manual page, but make it cute
okay so bestie, welcome to paho_cs_sub, straight out of manual section 1L β¨ it's a whole command, it's a whole vibe, and by the end of this page you're gonna understand it fr fr. no skimming, we're going line by line because everything here matters π«Ά
π NAME π
paho_cs_sub β receive (subscribe to) data from an MQTT server. that's it, that's the job π
β¨ SYNOPSIS β¨
paho_cs_sub [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]
heads up:-i/--clientid,-u/--username,-P/--password,-k/--keepaliveand--verboseshow up right there in the synopsis, so they're real options you can pass β they just don't get their own little paragraph down in OPTIONS. iykyk π
π DESCRIPTION π
so paho_cs_sub receives data from an MQTT server, and it does it using the Eclipse Paho C client synchronous library (MQTTClient) β iconic combo, no cap π§
and what even is MQTT? okay so: MQTT is a protocol that runs over TCP/IP, and it lets programs talk to each other super easily through a server πΈ messages get published to topics, and then they get delivered to literally anyone subscribed to those topics. it's giving group chat but for programs, honestly.
and the matching publisher program β the one that sends instead of receives β is paho_cs_pub. bestie duo, periodt π
the default mode of operation? every message gets output to stdout, terminated by the delimiter. simple. slay.
π OPTIONS π
-t,--topicβ the MQTT topic to publish the data to π-c,--connectionβ the MQTT URI to connect to: it's a combo of transport prefix, host, port, and for websockets, the topic. want TCP? use thetcpprefix, liketcp://localhost:1883β¨ SSL/TLS example: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 to connect to. together with the--portoption, it's the older alternative to using--connectionπ¦-p,--portβ the TCP/IP port number of the MQTT server to connect to. together with the--hostoption, it's the older alternative to using--connectionπ¦-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) π₯--quietβ do not print error messages π€«--traceβ print library internal trace. valid levels aremin,max,errorandprotocolπ-R,--no-retainedβ do not print messages which have the MQTT retained flag set π--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 π«--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 π--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 are0,1or2β--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 π
β οΈ bestie, quick vibe check: every single one of the TLS options (--cafile,--capath,--cert,--key,--keypass,--ciphers,--insecure) is only used with a TLS connection, and--will-payload,--will-qosand--will-retainare only used if will-topic is set. don't be out here setting them and wondering why nothing happened π
and that's the whole page, bestie. you ate it. π
this beauty lives over at http://eclipse.org/paho, and this version is dated 31 July 2018 (v1.3.0) β so yeah, it's an elder icon and we respect it π thanks for coming to my ted talk, 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