0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MQTT over WebSocket: localhost でのテスト

Last updated at Posted at 2025-02-04

Arch Linux でテストしました。

参考ページ
MQTT: localhost でのテスト

mosquitto の設定変更

/etc/mosquitto/mosquitto.conf
listener 8083
allow_anonymous true
listener 8080
protocol websockets

再起動

sudo systemctl restart mosquitto

Publish

BROKER="localhost"
#
echo $BROKER
message="Hello Mqtt "`date`
mosquitto_pub -d -t orz -m "${message}" \
    -h  $BROKER \
    --topic example/testTopic -p 8083

Subscribe

BROKER="localhost"
#
mosquitto_sub -d -t orz -h $BROKER \
    --topic example/testTopic -p 8083

mqtt コマンドライン を使って接続

Publish

mqtt pub -t 'example/testTopic' -h 'localhost' -p 8083 -m 'Good Afternoon'

Subscribe

mqtt sub -t 'example/testTopic' -h 'localhost' -p 8083 -v
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?