From 714aa4dc9d4aa97437fdd4036ab73657b1776381 Mon Sep 17 00:00:00 2001 From: Feng Date: Thu, 17 Dec 2015 12:38:48 +0800 Subject: [PATCH] subscription --- rel/files/emqttd.config.development | 16 ++++++++++++---- rel/files/emqttd.config.production | 14 +++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/rel/files/emqttd.config.development b/rel/files/emqttd.config.development index 50339361c..76375d227 100644 --- a/rel/files/emqttd.config.development +++ b/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, [ diff --git a/rel/files/emqttd.config.production b/rel/files/emqttd.config.production index e602e60ba..ef18232b8 100644 --- a/rel/files/emqttd.config.production +++ b/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, [