1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MQTTX の使いかた (クライアント)

Last updated at Posted at 2021-09-08

Arch Linux でのインストール方法

yay mqttx-bin

Ubuntu でのインストール方法

wget https://www.emqx.com/ja/downloads/MQTTX/v1.11.1/MQTTX_1.11.1_amd64.deb
sudo dpkg -i MQTTX_1.11.1_amd64.deb

起動

mqttx

起動直後の画面
mqttx_aa.png

Name だけを入力してあとはディフォールトのままで接続。
broker.emqx.io がプローカーになります。
mqttx_bb.png

Topic を入力して Publish
mqttx_cc.png

mosquitto で同じブローカー、同じトピックスに接続していれば次のようになります。

$ mosquitto_sub -h broker.emqx.io --topic sample/imageTopic
{
  "msg": "Hello"
}

Topic を入れて subscribe の用意
mqttx_dd.png

mosquitto で publsish する。
サンプルのスクリプト

go_pub_mqtt.sh
BROKER="broker.emqx.io"
#
TOPIC="sample/imageTopic"
#
echo $BROKER
message='{"name": "sensor3", "temp": 26.3}'
echo ${message}
mosquitto_pub -d -t orz -m "${message}" -h $BROKER --topic $TOPIC

受信した状況
mqttx_ee.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?