z_mqtt_sessions_runtime (zotonic_core v1.0.0-rc.17)
Zotonic specific callbacks for MQTT connections
Summary
Functions
If the connection is authenticated, then the connection user MUST be the session user.
Re-authentication. This is called when the client requests a re-authentication (or replies in a AUTH re-authentication).
Return the MQTT pool name for the given hostname.
Functions
-spec connect(mqtt_packet_map:mqtt_packet(), boolean(), mqtt_sessions:msg_options(), z:context()) -> {ok, mqtt_packet_map:mqtt_packet(), z:context()} | {error, term()}.
-spec control_message(SubTopic, Message, Context) -> {ok, Context1} when SubTopic :: [binary()], Message :: mqtt_packet_map:mqtt_packet(), Context :: z:context(), Context1 :: z:context().
-spec is_allowed(publish | subscribe, mqtt_sessions_runtime:topic(), mqtt_packet_map:mqtt_packet(), z:context()) -> boolean().
-spec is_valid_message(mqtt_packet_map:mqtt_packet(), mqtt_sessions:msg_options(), z:context()) -> boolean().
If the connection is authenticated, then the connection user MUST be the session user.
-spec new_user_context(Site, ClientId, SessionOptions) -> Context when Site :: atom(), ClientId :: binary(), SessionOptions :: mqtt_sessions:session_options(), Context :: z:context().
-spec pool_default() -> {error, unknown_host}.
-spec reauth(mqtt_packet_map:mqtt_packet(), z:context()) -> {ok, mqtt_packet_map:mqtt_packet(), z:context()} | {error, term()}.
Re-authentication. This is called when the client requests a re-authentication (or replies in a AUTH re-authentication).
Return the MQTT pool name for the given hostname.