Telemetry Transfer (tt) - manual
The tt command provides a mqtt-v5 server and pub/sub clients for
general use. Project source is found at sogvin.com/tt. The
intention of this manual is to describe the features of each command
and how it conform to the specification where possible.
Table of Contents
1 Usage ..........................................................
2 Commands .......................................................
2.1 pub ..........................................................
2.1.1 Publish QoS 0 ..............................................
2.2 sub ..........................................................
2.2.1 Subscribe all topics .......................................
2.3 srv ..........................................................
2.3.1 Serve clients on tcp://localhost:11883 .....................
3 Quality of Service levels and protocol flows ...................
3.1 QoS 0: At most once deliveryQoS 0 ............................
3.2 ping pong ....................................................
1 Usage
Run tt command with -h or --help to show available subcommands and
options.
$ tt --help
Usage: tt [OPTIONS] COMMAND
Options
-d, --debug
-T, --log-timestamp
-Q, --quiet : false
hide log output
--timeout : 0
0 means never
-h, --help
Commands
pub (default)
-s, --server : tcp://localhost:1883
-c, --client-id : "ttpub"
-t, --topic-name : "gopher/pink"
-p, --payload : "hug"
-q, --qos : 0
-u, --username : ""
-p, --password : ""
-n, --count : 1
-r, --retain : false
sub
-s, --server : tcp://localhost:1883
-c, --client-id : "ttsub"
-t, --topic-filter : "#"
-q, --qos : 1
filter quality of service
-k, --keep-alive : 10s
disable with 0
-r, --auto-reconnect
srv
-b, --bind-tcp, $TT_BIND_TCP : tcp://localhost:
-a, --accept-timeout : 500ms
--connect-timeout : 200ms
--log-prefix : ""
--pprof
bench
-u, --use-case : "singlenode-conn-tcp-10K-100" [singlenode-conn-tcp-10K-100]
-s, --server : tcp://localhost:1883
-c, --client-id : "bench"
client id is used as prefix when multiple clients connect
mon
-s, --server : tcp://localhost:1883
-c, --client-id : "ttmon"
-q, --qos : 1
filter quality of service
-k, --keep-alive : 10s
disable with 0
-r, --auto-reconnect
2 Commands
2.1 pub
Client for publishing application messages to a mqtt-v5 server.
2.1.1 Publish QoS 0
Default command publishes a predefined message to a local server.
$ tt
ttpub dial tcp://localhost:1883
ttpub CONNECT ---- ------s- MQTT5 ttpub 0s 20 bytes
ttpub CONNACK ---- -------- 11 bytes (in)
ttpub PUBLISH ---- p0 gopher/pink 19 bytes
ttpub DISCONNECT ---- 2 bytes
2.2 sub
Client subscribing to topic patterns.
2.2.1 Subscribe all topics
Default sub command subscribes to all topics and blocks until
interrupted.
$ tt sub
ttsub dial tcp://localhost:1883
ttsub CONNECT ---- -------- MQTT5 ttsub 10s 23 bytes
ttsub CONNACK ---- -------- 11 bytes (in)
ttsub SUBSCRIBE --1- p1 # --r0-n-1 11 bytes
ttsub SUBACK ---- p1 6 bytes (in)
interrupt
2.3 srv
2.3.1 Serve clients on tcp://localhost:11883
$ tt srv -b tcp://localhost:11883
3 Quality of Service levels and protocol flows
This section illustrates flows using tt client and server as specified in mqtt section 4.3
3.1 QoS 0: At most once deliveryQoS 0
Clients connect to the same server. First client subscribes to topic
filter gopher/+, and second publishes a message to topic name
gopher/pink. Log messages are grouped for clarity.
See mqtt section 4.3.1
$ tt srv -b --log-prefix ttsrv tcp://localhost:11883&
$ tt sub -t gopher/+ -s tcp://localhost:11883&
ttsub dial tcp://localhost:11883
ttsub CONNECT ---- -------- MQTT5 ttsub 10s 23 bytes
ttsub CONNACK ---- -------- 7 bytes (in)
ttsub SUBSCRIBE --1- p1 gopher/+ --r0-n-1 18 bytes
ttsub SUBACK ---- p1 6 bytes (in)
ttsub PUBLISH ---- p0 gopher/pink 19 bytes (in)
PAYLOAD hug
$ tt pub -s tcp://localhost:11883
ttpub dial tcp://localhost:11883
ttpub CONNECT ---- ------s- MQTT5 ttpub 0s 20 bytes
ttpub CONNACK ---- -------- 7 bytes (in)
ttpub PUBLISH ---- p0 gopher/pink 19 bytes
ttpub DISCONNECT ---- 2 bytes
3.2 ping pong
Server responds to ping requests.
$ tt srv -b tcp://localhost:11883&
$ tt sub -s tcp://localhost:11883 --keep-alive 1s&
ttsub dial tcp://localhost:11883
ttsub CONNECT ---- -------- MQTT5 ttsub 1s 23 bytes
ttsub CONNACK ---- -------- 7 bytes (in)
ttsub SUBSCRIBE --1- p1 # --r0-n-1 11 bytes
ttsub SUBACK ---- p1 6 bytes (in)
ttsub PINGREQ ---- 2 bytes
ttsub PINGRESP ---- 2 bytes (in)