Feng 10 лет назад
Родитель
Сommit
714aa4dc9d
2 измененных файлов с 23 добавлено и 7 удалено
  1. 12 4
      rel/files/emqttd.config.development
  2. 11 3
      rel/files/emqttd.config.production

+ 12 - 4
rel/files/emqttd.config.development

@@ -1,6 +1,6 @@
 % -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
 %% ex: ft=erlang ts=4 sw=4 et
-[{kernel, 
+[{kernel,
     [{start_timer, true},
      {start_pg2, true}
  ]},
@@ -175,14 +175,22 @@
     {modules, [
         %% Client presence management module.
         %% Publish messages when client connected or disconnected
-        {presence, [{qos, 0}]}
+        {presence, [{qos, 0}]},
 
         %% Subscribe topics automatically when client connected
-        %% {autosub, [{"$Q/client/$c", 0}]}
+        {subscription, [
+            %% Subscription from stored table
+            stored,
+
+            %% $u will be replaced with username
+            {"$Q/username/$u", 1},
+
+            %% $c will be replaced with clientid
+            {"$Q/client/$c", 1}
+        ]}
 
         %% Rewrite rules
         %% {rewrite, [{file, "etc/rewrite.config"}]}
-        
     ]},
     %% Plugins
     {plugins, [

+ 11 - 3
rel/files/emqttd.config.production

@@ -167,14 +167,22 @@
     {modules, [
         %% Client presence management module.
         %% Publish messages when client connected or disconnected
-        {presence, [{qos, 0}]}
+        %% {presence, [{qos, 0}]},
 
         %% Subscribe topics automatically when client connected
-        %% {autosub, [{"$Q/client/$c", 0}]}
+        %% {subscription, [
+        %%    %% Subscription from stored table
+        %%    stored,
+        %%
+        %%   %% $u will be replaced with username
+        %%    {"$Q/username/$u", 1},
+        %%
+        %%   %% $c will be replaced with clientid
+        %%    {"$Q/client/$c", 1}
+        %% ]}
 
         %% Rewrite rules
         %% {rewrite, [{file, "etc/rewrite.config"}]}
-        
     ]},
     %% Plugins
     {plugins, [