1<!-- 2Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 4SPDX-License-Identifier: curl 5--> 6 7# MQTT in curl 8 9## Usage 10 11A plain "GET" subscribes to the topic and prints all published messages. 12 13Doing a "POST" publishes the post data to the topic and exits. 14 15 16### Subscribing 17 18Command usage: 19 20 curl mqtt://host/topic 21 22Example subscribe: 23 24 curl mqtt://host.home/bedroom/temp 25 26This will send an MQTT SUBSCRIBE packet for the topic `bedroom/temp` and listen in for incoming PUBLISH packets. 27 28### Publishing 29 30Command usage: 31 32 curl -d payload mqtt://host/topic 33 34Example publish: 35 36 curl -d 75 mqtt://host.home/bedroom/dimmer 37 38This will send an MQTT PUBLISH packet to the topic `bedroom/dimmer` with the payload `75`. 39 40## What does curl deliver as a response to a subscribe 41 42Whenever a PUBLISH packet is received, curl outputs two bytes topic length (MSB | LSB), the topic followed by the 43payload. 44 45## Caveats 46 47Remaining limitations: 48 - Only QoS level 0 is implemented for publish 49 - No way to set retain flag for publish 50 - No TLS (mqtts) support 51 - Naive EAGAIN handling does not handle split messages 52