View Source mqtt_sessions_runtime behaviour (mqtt_sessions v2.3.0)

MQTT sessions runtime ACL interface.

Link to this section Summary

Functions

Check a message and its options before it is processed. Used for http connections with authentication cookies.
Re-authentication. This is called when the client requests a re-authentication (or replies in a AUTH re-authentication).

Link to this section Types

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

Link to this section 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 is_valid_message(mqtt_packet_map:mqtt_packet(), mqtt_sessions:msg_options(), 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()}.

Link to this section Functions

Link to this function

connect(Packet, IsSessionPresent, Options, UserContext)

View Source
-spec connect(mqtt_packet_map:mqtt_packet(), boolean(), mqtt_sessions:msg_options(), user_context()) ->
           {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.
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
-spec is_valid_message(mqtt_packet_map:mqtt_packet(), mqtt_sessions:msg_options(), user_context()) ->
                    boolean().
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 pool_default() -> {ok, atom()} | {error, term()}.
-spec reauth(mqtt_packet_map:mqtt_packet(), user_context()) ->
          {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {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()}.