View Source mqtt_sessions_runtime behaviour (mqtt_sessions v2.6.1)

MQTT sessions runtime ACL interface.

Summary

Functions

Check a message and its options before it is processed. Used for http connections with authentication cookies.
Called on a pingreq message from the remote. Used this to keep processes or track connection status.
Re-authentication. This is called when the client requests a re-authentication (or replies in a AUTH re-authentication).

Types

-type topic() :: [binary()].
-type user_context() :: term().

Callbacks

-callback connect(mqtt_packet_map:mqtt_packet(), boolean(), map(), user_context()) ->
           {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.
-callback control_message(topic(), mqtt_packet_map:mqtt_packet(), user_context()) -> {ok, user_context()}.
-callback is_allowed(publish | subscribe, topic(), mqtt_packet_map:mqtt_packet(), user_context()) ->
              boolean().
-callback new_user_context(atom(), binary(), mqtt_sessions:session_options()) -> term().
-callback pool_default() -> {ok, atom()} | {error, term()}.
-callback reauth(mqtt_packet_map:mqtt_packet(), user_context()) ->
          {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.
-callback vhost_pool(binary()) -> {ok, atom()} | {error, term()}.

Functions

Link to this function

connect(Packet, IsSessionPresent, Options, UserContext)

View Source
Link to this function

control_message(Topic, Packet, UserContext)

View Source
-spec control_message(topic(), mqtt_packet_map:mqtt_packet(), user_context()) -> {ok, user_context()}.
Link to this function

is_allowed(_, Topic, Packet, UserContext)

View Source
-spec is_allowed(publish | subscribe, topic(), mqtt_packet_map:mqtt_packet(), user_context()) ->
              boolean().
Link to this function

is_valid_message(Msg, Options, UserContext)

View Source
Check a message and its options before it is processed. Used for http connections with authentication cookies.
Link to this function

new_user_context(Pool, ClientId, Options)

View Source
-spec new_user_context(atom(), binary(), mqtt_sessions:session_options()) -> term().
-spec ping(UserContext) -> {ok, UserContext1}
        when UserContext :: user_context(), UserContext1 :: user_context().
Called on a pingreq message from the remote. Used this to keep processes or track connection status.
-spec pool_default() -> {ok, atom()} | {error, term()}.
Re-authentication. This is called when the client requests a re-authentication (or replies in a AUTH re-authentication).
-spec vhost_pool(binary()) -> {ok, atom()} | {error, term()}.