标签归档:mqtt

Mosquitto设置websockets(wss)服务器及使用javascript客户端连接

最近项目需要使用 MQTT服务,出于安全考虑,web服务器使用了 https,web连接mqtt服务器也使用了websockets(wss)

Mosquitto配置websockets

mosquitto.conf 添加:

listener 8081
protocol websockets
cafile /home/phpquan.com/1_root_bundle.crt        #根证书
certfile /home/phpquan.com/2_phpquan.com.crt      #域名证书crt
keyfile /home/phpquan.com/3_phpquan.com.key       #域名证书key
继续阅读