INTRO
The n2o_auth module provides EMQ auth hook that perform client's autosubscribe to client topic.
CALLBACK
check(#mqtt_client{},binary(),term()) -> ok | ignore.
The default implementation performs client topic autosubscribe at server side.
check(#mqtt_client{client_id = ClientId, username = PageModule,
client_pid = ClientPid,
ws_initial_headers = _Headers},
Password, Listeners) ->
ClientId = ensure_id(Client),
case ClientId of
<<"emqttd_", _/binary>> ->
emqttd_client:subscribe(ClientPid,
[{n2o:to_binary(["actions/1/",PageModule,"/",ClientId]), 2}]),
ignore;
_ -> ignore
end.