https://github.com/subpop/mqttcli
A simple MQTT command-line client
https://github.com/subpop/mqttcli
Last synced: about 1 month ago
JSON representation
A simple MQTT command-line client
- Host: GitHub
- URL: https://github.com/subpop/mqttcli
- Owner: subpop
- License: gpl-3.0
- Created: 2021-04-23T12:58:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-12-17T17:14:08.000Z (4 months ago)
- Last Synced: 2025-12-19T14:07:51.046Z (4 months ago)
- Language: Go
- Homepage:
- Size: 73.2 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
package `mqttcli` is a program that provides two subcommands (`pub` and `sub`)
that allow command-line level access to an MQTT broker.
`sub` subscribes to a topic and prints messages received to standard output.
`pub` publishes the provided message to the provided topic. Both programs accept
flags that can be provided as a config file.
## Examples
### Flags ###
* `go run ./cmd/sub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/test`
* `echo hello | go run ./cmd/pub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/test`
### Config File ###
```
cat > sub.cfg << EOF
broker tcp://test.mosquitto.org:1883
topic mqttcli/test
EOF
go run ./cmd/sub -config sub.cfg
```
```
cat > pub.cfg << EOF
broker tcp://test.mosquitto.org:1883
topic mqttcli/test
EOF
echo hello | go run ./cmd/pub -config pub.cfg
```