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不加会致使链接失败。
相关文章
相关标签/搜索