项目作者: igolaizola

项目描述 :
MQTT client that creates a data stream using two topics
高级语言: Go
项目地址: git://github.com/igolaizola/mqtt-stream.git
创建时间: 2020-02-07T08:43:06Z
项目社区:https://github.com/igolaizola/mqtt-stream

开源协议:Apache License 2.0

下载


GitHub release
Go Report Card
license

mqtt-stream

MQTT client that creates a data stream using two topics

  • Data from topic from goes to stdout.
  • Data from stdin goes topic to.
  • If echo is enabled: data from topic from goes to topic to.

Usage

  1. mqtt-stream --host tcp://test.mosquitto.org:1883 --from bar --to foo

Launch mqtt-stream --help to see all available parameters.

Echo example using mosquitto

Create a subscription to foo topic using mosquitto_sub

  1. mosquitto_sub -h test.mosquitto.org -t bar

Launch mqtt-stream with echo enabled

  1. mqtt-stream --host tcp://test.mosquitto.org:1883 --from bar --to foo --echo

Publish some data to topic bar using mosquitto_pub

  1. mosquitto_pub -h test.mosquitto.org -t bar -m "hello world"

Output

  1. $ mosquitto_sub -h test.mosquitto.org -t foo
  2. hello world
  1. $ mqtt-stream --host tcp://test.mosquitto.org:1883 --from bar --to foo
  2. 2020/02/05 13:51:45 connecting to tcp://test.mosquitto.org:1883...
  3. 2020/02/05 13:51:45 connected!
  4. 2020/02/05 13:51:45 subscribed to bar, publishing to foo
  5. 2020/02/05 13:51:46 hello world