MQTT入门(4)- 客户端工具

(1)开发包Library

Eclipse Paho 提供了各种开发语言使用的开发SDK,比如:
Python:https://github.com/eclipse/paho.mqtt.python
JavaScript:https://github.com/eclipse/paho.mqtt.javascript
Java:https://github.com/eclipse/paho.mqtt.java
Android Service:https://github.com/eclipse/paho.mqtt.android

MQTT.js https://github.com/mqttjs/MQTT.js

(2)工具Tools

GUI工具

Eclipse Paho MQTT Utility
从 https://repo.eclipse.org/content/repositories/paho-releases/org/eclipse/paho/org.eclipse.paho.ui.app/1.1.1/ 下载org.eclipse.paho.ui.app-1.1.1-win32.win32.x86_64.zip 后解压到本地。


点击加号新建一个连接,地址里输入服务器地址 tcp://iot.eclipse.org:1883 后点击“Connect”按钮


选择“Subscription”下方的绿色十字图标输入订阅的主题(topic)的名字,比如我们设置主题名称为“test/rensanning/time”,并点击 “Subscribe”按钮。


在Publication 里输入主题名称为“test/rensanning/time”,输入消息内容,点击“Publish”按钮


MQTT.fx:http://www.mqttfx.org/
基于Java的MQTT客户端,1.5.0版本有Windows和MacOS版本,1.5.1以后就只有MacOS版本了。http://www.jensd.de/apps/mqttfx/1.5.0/mqttfx-1.5.0-windows-x64.exe

设置Broker服务器信息,点击“Connect”按钮连接到服务器


输入Topic名、消息内容后,点击Publish按钮发布消息。


输入Topic名后,点击Subscribe按钮订阅主题


查看Log


MQTT-spy:https://github.com/eclipse/paho.mqtt-spy
Eclipse Paho官方提供的MQTT客户端,基于Java的。
下载 mqtt-spy-1.0.1-beta-b13-jar-with-dependencies.jar 文件后执行即可。

设置Broker服务器信息,点击“Open connection”按钮连接到服务器



输入Topic名、消息内容后,点击Publish按钮发布消息。


点击“New”输入Topic名后,点击Subscribe按钮订阅主题


测试发布消息和消息订阅


Eclipse Paho官方还提供了一个Web界面的客户端测试页面,基于JavaScript的。
http://www.eclipse.org/paho/clients/js/utility/


CLI工具

Mosquitto http://mosquitto.org/
Mosquitto不仅提供了Broker服务,而且提供了2个很好用的CLI工具。
引用
$ mosquitto_pub -h iot.eclipse.org -p 8883 -t test/rensanning/time -m "test message from mosquitto_pub"

引用
$ mosquitto_sub -h iot.eclipse.org -p 8883 -t test/rensanning/time



参考:
https://www.hivemq.com/blog/seven-best-mqtt-client-tools
https://www.hivemq.com/blog/category/mqtt-toolbox/

猜你喜欢

转载自rensanning.iteye.com/blog/2406598