Skip to content

Commit

Permalink
feat: mqtt auth
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnwinterLiu committed Apr 22, 2024
1 parent 59d44aa commit 202bf36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/dgiot_dlink/src/proctol/dgiot_mqtt_auth.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ check(#{clientid := <<Token:34/binary, _Type/binary>> = ClientId, username := Us
case dgiot_auth:get_session(Token) of
#{<<"objectId">> := UserId} = User ->
%% 登录时订阅告警推送
sub_notification(ClientId, maps:get(<<"roles">>, User, #{})),
spawn(fun() ->
timer:sleep(1000 * 10),
sub_notification(ClientId, maps:get(<<"roles">>, User, #{}))
end),
save_client(ClientId),
{stop, AuthResult#{anonymous => false, auth_result => success}};
_ ->
Expand Down

0 comments on commit 202bf36

Please sign in to comment.