View Source mqtt_sessions_runtime behaviour (mqtt_sessions v2.6.1)
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
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 reauth(mqtt_packet_map:mqtt_packet(), user_context()) -> {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.
Functions
-spec connect(mqtt_packet_map:mqtt_packet(), boolean(), mqtt_sessions:msg_options(), user_context()) -> {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.
-spec control_message(topic(), mqtt_packet_map:mqtt_packet(), user_context()) -> {ok, user_context()}.
-spec is_allowed(publish | subscribe, topic(), mqtt_packet_map:mqtt_packet(), user_context()) -> boolean().
-spec is_valid_message(mqtt_packet_map:mqtt_packet(), mqtt_sessions:msg_options(), user_context()) -> boolean().
-spec new_user_context(atom(), binary(), mqtt_sessions:session_options()) -> term().
-spec ping(UserContext) -> {ok, UserContext1} when UserContext :: user_context(), UserContext1 :: user_context().
-spec reauth(mqtt_packet_map:mqtt_packet(), user_context()) -> {ok, mqtt_packet_map:mqtt_packet(), user_context()} | {error, term()}.