@kcarbone/mqtt-debugger
v1.0.1
Published
Simple debug util for mqtt client
Readme
mqtt-debugger
Simple debug util for MQTT client traffic.
Usage
mqtt-debugger [options] [topicFilter] [propFilter] [valueFilter]The command subscribes to the broker and prints only messages matching your filters.
CLI arguments
Options
| Option | Default | Description |
| --- | --- | --- |
| -h <host> | localhost | MQTT broker host |
| -p <port> | 1883 | MQTT broker port |
| -a <username:password> | admin:password | MQTT credentials in username:password format |
Positional arguments
| Argument | Default | Description |
| --- | --- | --- |
| topicFilter | # | Case-insensitive regex matched against topic names |
| propFilter | '' | Case-insensitive regex matched against JSON property names |
| valueFilter | '' | Case-insensitive regex matched against matched property values |
Notes:
- Filters are interpreted as JavaScript regular expressions.
- Message payloads are parsed as JSON.
Usage examples
Listen to everything on localhost:
npx @kcarbone/mqtt-debuggerConnect to a remote broker with auth:
npx @kcarbone/mqtt-debugger -h broker.example.com -p 1883 -a myuser:mypasswordShow only topics containing sensor:
npx @kcarbone/mqtt-debugger sensorShow only temperature properties from topics matching devices/:
npx @kcarbone/mqtt-debugger 'devices/' 'temperature'Show only status values matching error|fail from topics matching devices/:
npx @kcarbone/mqtt-debugger 'devices/' 'status' 'error|fail'