文章詳情頁
教你在windows下搭建MQTT服務(wù)器的方法
瀏覽:12日期:2023-02-28 17:21:46
目錄
- 一、下載mosquitto
- 二、配置mosquitto
- 1. 安裝路徑打開命令行界面
- 2. 設(shè)置user及password
- 3. 配置文件檢查
- 4. 設(shè)置端口
- 5. 訂閱者
- 6. 發(fā)布者
- 7. 命令行測試
- 三、MQTTX
- 1. 連接服務(wù)器
- 2. 訂閱topic
- 3. 發(fā)布消息
一、下載mosquitto
點(diǎn)擊下載安裝程序 下載地址
二、配置mosquitto
1. 安裝路徑打開命令行界面
2. 設(shè)置user及password
執(zhí)行:mosquitto_passwd.exe -c pwfile.example -u vic
設(shè)置用戶名:vic 設(shè)置密碼:123456
3. 配置文件檢查
mosquitto.exe -c mosquitto.conf
未報(bào)錯(cuò)說明配置正常
4. 設(shè)置端口
默認(rèn)端口:1883
啟動(dòng):mosquitto.exe
指定端口啟動(dòng):mosquitto.exe -p 10086
5. 訂閱者
mosquitto_sub.exe -h 127.0.0.1 -p 10086 -t topicTest01 -u vic -P 123456
6. 發(fā)布者
mosquitto_pub.exe -h 127.0.0.1 -p 10086 -u admin -P 111 -t topicTest01 -m "hello world"
7. 命令行測試
三、MQTTX
1. 連接服務(wù)器
2. 訂閱topic
3. 發(fā)布消息
到此這篇關(guān)于windows搭建MQTT服務(wù)器的文章就介紹到這了,更多相關(guān)MQTT服務(wù)器搭建內(nèi)容請(qǐng)搜索以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持!
排行榜
