1SUB(1)                                                                  SUB(1)
2
3
4

NAME

6       sub - subscribe to MQTT topics
7

SYNOPSIS

9       sub [OPTIONS]
10

DESCRIPTION

12       sub connects to the given MQTT broker and subscribes to all topics
13       specified. Messages received on a topic are printed to stdout, prefixed
14       with the topic the message was received on.
15
16       All options can be passed either as command-line arguments or can be
17       specified in a simple config file.
18

OPTIONS

20       -auto-reconnect
21           automatically reconnect when connection is lost
22
23       -broker URL
24           broker address (should be in the form of a URL)
25
26       -ca-root FILE
27           path to a FILE containing CA certificates (optional)
28
29       -cert-file FILE
30           authenticate with a certificate
31
32       -clean
33           discard any pending messages from the broker (default true)
34
35       -client-id STRING
36           unique identifier for this client (defaults to a semi-random
37           string)
38
39       -connect-retry
40           automatically retry initial connection to broker
41
42       -connect-retry-interval DURATION
43           wait DURATION between initial connection attempts (default 30s)
44
45       -config FILE
46           path to FILE containing configuration values (optional)
47
48       -header KEY=VALUE
49           set an HTTP header (in KEY=VALUE form) (can be specified multiple
50           times)
51
52       -key-file FILE
53           authenticate with a private key
54
55       -password STRING
56           authenticate with a password
57
58       -qos INTEGER
59           quality of service for messages
60
61       -tls-alpn STRING
62           ALPN value to include in the TLS handshake (can be specified
63           multiple times)
64
65       -topic STRING
66           topic to publish or subscribe to (can be specified multiple times)
67
68       -username STRING
69           authenticate with a username
70
71       -verbose
72           increase output
73
74       -version
75           print version
76

CONFIGURATION

78       Any option may be specified as a value in a configuration file instead
79       of (or in addition to) a command-line option. Values present on the
80       command-line take precedent over values in the configration file. Thus
81       it is easy to create a base configration file that can be augmented
82       easily at run time.
83
84       The configuration file takes the form of a simple space-separated
85       "option value" format (i.e. "broker tcp://test.mosquitto.org:1883").
86

EXAMPLES

88       Connect to a broker anonymously and subscribe to two topics.
89
90           sub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/pubtest -topic mqttcli/pubtest1
91
92       Connect to a broker using username/password authentication and
93       subscribe to a topic.
94
95           sub -broker tcp://test.mosquitto.org:1884 -username ro -password readonly -topic mqttcli/pubtest
96

AUTHOR

98       Link Dupont <link@sub-pop.net>
99           Author.
100
101
102
103                                  09/28/2023                            SUB(1)
Impressum