mqtt之mosquitto

http://www.javashuo.com/article/p-sttwmfeh-gk.html
http://www.javashuo.com/article/p-tocxgqlh-kr.html
http://www.javashuo.com/article/p-nbzatlbi-gq.html
http://www.javashuo.com/article/p-sttwmfeh-gk.html
http://www.pianshen.com/article/7955417306/html

https://blog.csdn.net/qq_29350001/article/details/77161537 //good測試

//編譯執行測試
//當須要添加用戶時,有兩種方法,一修改配置文件,給pc主機添加用戶,推薦第一種
http://www.javashuo.com/article/p-ryocvrlx-hc.htmlui

//單向認證與雙向認證
http://www.javashuo.com/article/p-wkutmqdu-hh.html.net

一、修改config.mk
prefix=/home/retry/mqtt_pc //指定本身的編譯路徑

二、編譯
make WITH_SRV=no 

三、安裝
make install


四、拷貝一份mosquitto.conf到etc目錄下

五、測試
mosquitto -c /etc/mosquitto/mosquitto.conf   //啓動代理
mosquitto_pub  -p 1883 -t "mqtt/server/topic" -m " hello,world"
mosquitto_sub  -p 1883 -t "mqtt/server/topic" 


2、ssl認證
一、修改mosquitto.conf文件

mosquitto -c /etc/mosquitto/mosquitto.conf   //啓動代理
mosquitto_pub  -p 1883 -t "mqtt/server/topic" -m " hello,world" --cafile /etc/mosquitto/ca.crt --insecure
mosquitto_sub  -p 1883 -t "mqtt/server/topic" --cafile /etc/mosquitto/ca.crt --insecure

測試發現:--insecure不加會致使鏈接失敗。
相關文章
相關標籤/搜索