over 4 years ago

Mosquitto 是Open Source的MQTT Broker

此篇筆記主要是記錄如何安裝並使用Mosquitto

下載

http://mosquitto.org/download/
選擇自己的OS,這裡將以win7為例 (mosquitto-1.3.2-install-win32.exe)

安裝

Follow Installer,基本上就一路按下一步
安裝完成後,目錄會放在
C:\Program Files(x86)\mosquitto
並且會新增環境變數
MOSQUITTO_DIR指到該目錄

操作

Broker的主程式為mosquitto.exe
操作方法為
mosquitto.exe -v -p port
我會習慣下-v來啟動verbose mode,方便作debug
default port是1883


到這邊為止,已經成功跑起一個MQTT Broker!

另外,在Mosquitto的目錄下還提供了publish/subscribe的程式,可以拿來玩一玩
publish:
mosquitto_pub.exe -h host -p port -q qos -t topic -m message
subscribe:
mosquitto_sub.exe -h host -p port -q qos -t topic

DEMO

1.啟動Broker
2.Subscriber 註冊感興趣的Topic(ex. sensor/temperature)


3.Publisher 發布該Topic的訊息

4.Sbscriber 接收Topic訊息

← [Linux]Screen 速記 [Linux]Effetcive User ID(euid) →
 
comments powered by Disqus