Client sub/unsub mount topic
This commit is contained in:
parent
58e3555e9b
commit
92f3036f1f
|
@ -162,11 +162,12 @@ received(Packet = ?PACKET(Type), State = #proto_state{stats_data = Stats}) ->
|
||||||
|
|
||||||
subscribe(RawTopicTable, ProtoState = #proto_state{client_id = ClientId,
|
subscribe(RawTopicTable, ProtoState = #proto_state{client_id = ClientId,
|
||||||
username = Username,
|
username = Username,
|
||||||
session = Session}) ->
|
session = Session,
|
||||||
|
mountpoint = MountPoint}) ->
|
||||||
TopicTable = parse_topic_table(RawTopicTable),
|
TopicTable = parse_topic_table(RawTopicTable),
|
||||||
case emqttd_hooks:run('client.subscribe', [ClientId, Username], TopicTable) of
|
case emqttd_hooks:run('client.subscribe', [ClientId, Username], TopicTable) of
|
||||||
{ok, TopicTable1} ->
|
{ok, TopicTable1} ->
|
||||||
emqttd_session:subscribe(Session, TopicTable1);
|
emqttd_session:subscribe(Session, mount(MountPoint, TopicTable1));
|
||||||
{stop, _} ->
|
{stop, _} ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
|
@ -174,10 +175,11 @@ subscribe(RawTopicTable, ProtoState = #proto_state{client_id = ClientId,
|
||||||
|
|
||||||
unsubscribe(RawTopics, ProtoState = #proto_state{client_id = ClientId,
|
unsubscribe(RawTopics, ProtoState = #proto_state{client_id = ClientId,
|
||||||
username = Username,
|
username = Username,
|
||||||
session = Session}) ->
|
session = Session,
|
||||||
|
mountpoint = MountPoint}) ->
|
||||||
case emqttd_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of
|
case emqttd_hooks:run('client.unsubscribe', [ClientId, Username], parse_topics(RawTopics)) of
|
||||||
{ok, TopicTable} ->
|
{ok, TopicTable} ->
|
||||||
emqttd_session:unsubscribe(Session, TopicTable);
|
emqttd_session:unsubscribe(Session, mount(MountPoint, TopicTable));
|
||||||
{stop, _} ->
|
{stop, _} ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue