Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stronnag/mqtttest

Couple of simple tools for testing MQTT, mainly for flightlog2kml/fl2mqtt and BulletGCSS
https://github.com/stronnag/mqtttest

bulletgcss fl2mqtt mqtt

Last synced: 19 days ago
JSON representation

Couple of simple tools for testing MQTT, mainly for flightlog2kml/fl2mqtt and BulletGCSS

Awesome Lists containing this project

README

        

# Simple MQTT tools

Two applications are provided primarily to test the usage of the MQTT protocol and specifically [BulletGCSS](https://github.com/danarrib/BulletGCSS) telemetry.

* **mqttsub** Subscribe to a MQTT service, display received data, optionally generate time-stamped log
* **mqttplayer** Replay a MQTT log (from `mqttsub` or BulletGCSS) to a MQTT server, preserving message timing.
* **mqttcap** Persistent subscription capture. `mqttcap` can be left running in the background and can capture MQTT data to distinct files in `logdir` from the `broker` subscription.

```
$ mqttsub --help
Usage of mqttsub -broker URI [options] ...
-broker string
Mqtt URI (mqtt://[user[:pass]@]broker[:port]/topic[?cafile=file])
-log string
log file for messages
-qos int
The QoS for message subscription
```

```
$ mqttplayer --help
Usage of mqttplayer -broker URI [options] file
-broker string
Mqtt URI (mqtt://[user[:pass]@]broker[:port]/topic[?cafile=file])
-fast
Speed up x10
-qos int
The QoS for message publication
```

```
$ mqttcap --help
Usage of mqttcap -broker URI [options] ...
-broker string
Mqtt URI (mqtt://[user[:pass]@]broker[:port]/topic[?cafile=file])
-logdir string
log directory for messages (default "/tmp")
-splittime int
split time for logs (default 300)
```

Note that the scheme (**mqtt**:// in the `--help` text) is interpreted as:

* ws - Websocket (vice TCP socket), ensure the websocket port is also specificed
* wss - Encrypted websocket, ensure the TLS websocket port is also specificed. TLS validation is performed using the system CA files.
* mqtts - Secure (TLS) TCP connection. Ensure the TLS port is specified. TLS validation is performed using the system CA files.
* mqtt (or anyother scheme) - TCP connection. If `?cafile=file` is specified, then that is used for TLS validation (and the TLS port should be specified).

## Log file

The log file generated by `mqttsub` contains payload data, prefixed with a time_t-like timestamp with millsecond precision. The timestamp and payload are separated by a TAB character.

```
1611845402.129 cs:JRandomUAV,
1611845402.130 flt:0,ont:60,ran:20,pan:-10,hea:263,ggc:200,alt:0,asl:33,gsp:0,bpv:16.80,cad:0,cud:0.11,rsi:100,
```

As well as `mqttsub` log files, `mqttplayer` can also replay [BulletGCSS](https://github.com/danarrib/BulletGCSS) log files. These are characterised by a millisecond Unix epoch timestamp, a '|' separator followed by the data.

if the log contains no timestamp and separator, the contents are replayed at 1 second interval.

## Installation

Requires a Go compiler and `make`.

```
make
```
then copy `mqttsub` and `mqttplayer` somewhere convenient.