学习mqtt协议和emqttd开源项目http://emqtt.com/
emqttd源码版本号是v1.1.3。http://emqtt.com/downloads/1113
1、-module(emqttd_app).
start(_StartType, _StartArgs) -> load_all_mods(),
2、读取emqttd.config文件,modules字段
%% Modules {modules, [ %% Client presence management module. %% Publish messages when client connected or disconnected {presence, [{qos, 0}]}, %% Subscribe topics automatically when client connected {subscription, [ %% $c will be replaced by clientid %% {"$queue/clients/$c", 1}, %% Static subscriptions from backend backend ]} %% Rewrite rules %% {rewrite, [{file, "etc/rewrite.config"}]} ]},
3、加载
-module(emqttd_mod_presence).
l
具体某个节点的某个clientId方式的主题是:
$SYS/brokers/emqttd@172.16.6.161/clients/861694030142478/connected
$SYS/brokers/emqttd@172.16.6.161/clients/861694030142478/disconnected
-module(emqttd_mod_subscription).
load(Opts) ->