MQTT 协议相关

Summary: Author: 张亚飞 | 阅读时间: 2 minute read | Published: 2015-09-23
Filed under Categories: LinuxTags: Note,

MQTT 协议相关

MQTT 服务器

使用 emqttd broken

emqttd 使用以下命令调试输出


cd emqttd
./bin/emqttd console

如果没有打印输出日志信息,可以参考取消 rel/files/emqttd.config.production./etc/emqttd.config 中对 %%{lager_console_backend, info} 的注释

EMQ Dashboard 后台证书配置

编辑配置 etc/plugins/emq_dashboard.confwss 相应的域名证书:

dashboard.listener.https = 18084
dashboard.listener.https.acceptors = 2
dashboard.listener.https.max_clients = 512
dashboard.listener.https.access.1 = allow all
dashboard.listener.https.keyfile = /etc/letsencrypt/archive/
dashboard.listener.https.certfile = /etc/letsencrypt/archive/


EMQ WSS 证书配置

编辑配置 etc/emq.confwss 相应的域名证书:

#listener.wss.external.keyfile = etc/certs/key.pem
listener.wss.external.keyfile = /etc/letsencrypt/archive/

#listener.wss.external.certfile = etc/certs/cert.pem
listener.wss.external.certfile = /etc/letsencrypt/archive/

## listener.wss.external.cacertfile = etc/certs/cacert.pem
listener.wss.external.cacertfile = /etc/letsencrypt/archive/

使用后台 wss 连接测试

使用 mqtt.js 连接测试

// you add a ws:// url here
var client = mqtt.connect('wss://');

注意: Android 配置连接方式 wss 需要服务器端配置 listener.wss.external.cacertfile.


生成 ca 证书:

cd /etc/letsencrypt/archive/
cat /etc/ssl/certs/DST_Root_CA_X3.pem chain.pem > ca.pem

编辑配置 etc/emq.confmqtt 相应的域名证书:

listener.ssl.external = 8883
listener.ssl.external.acceptors = 16
listener.ssl.external.max_clients = 1024
listener.ssl.external.access.1 = allow all
listener.ssl.external.handshake_timeout = 15s

listener.ssl.external.keyfile = /etc/letsencrypt/archive/
listener.ssl.external.certfile = /etc/letsencrypt/archive/
listener.ssl.external.cacertfile = /etc/letsencrypt/archive/



注意: Android 配置连接方式 ssl 需要服务器端配置 listener.ssl.external.cacertfile.


  • Allennex says: 2020-04-09 09:51:47

    Hello everyone! Seek out a demo of the game called X-Hex<a href=>.</a> The idea of the game is this<a href=>.</a> Field lozenge<a href=>.</a> On the fields put labels<a href=>.</a> Because of these points the field grows and becomes bigger<a href=>.</a> At the moment when it begins to touch the opponent’s field<a href=>.</a> Dots begin move now to the enemy, then back. The winner is the one who fills the entire field. There bonuses, a call to an aircraft that randomly bombes the enemy’s fields and can hurt yours. Very interesting toy. P<a href=>.</a>S<a href=>.</a> Thanks anyway You can reply to the mail<a href=>:</a> judbayneoranderson@gmail<a href=>.</a>com

Cor-Ethan, the beverage →