• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 sends an MQTT SUBSCRIBE packet for the topic `bedroom/temp` and listen in
27for incoming PUBLISH packets.
28
29### Publishing
30
31Command usage:
32
33    curl -d payload mqtt://host/topic
34
35Example publish:
36
37    curl -d 75 mqtt://host.home/bedroom/dimmer
38
39This sends an MQTT PUBLISH packet to the topic `bedroom/dimmer` with the
40payload `75`.
41
42## What does curl deliver as a response to a subscribe
43
44Whenever a PUBLISH packet is received, curl outputs two bytes topic length (MSB | LSB), the topic followed by the
45payload.
46
47## Caveats
48
49Remaining limitations:
50 - Only QoS level 0 is implemented for publish
51 - No way to set retain flag for publish
52 - No TLS (mqtts) support
53 - Naive EAGAIN handling does not handle split messages
54