z_mqtt_sessions_runtime (zotonic_core v1.0.0-rc.11)

Zotonic specific callbacks for MQTT connections

Link to this section 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.

Link to this section Functions

Link to this function

connect(Packet, IsSessionPresent, Options, Context)

-spec connect(mqtt_packet_map:mqtt_packet(), boolean(), mqtt_sessions:msg_options(), z:context()) ->
           {ok, mqtt_packet_map:mqtt_packet(), z:context()} | {error, term()}.
Link to this function

control_message(Topic, Packet, Context)

-spec control_message(list(), mqtt_packet_map:mqtt_packet(), z:context()) -> {ok, z:context()}.
Link to this function

is_allowed(Action, Topic, Packet, Context)

-spec is_allowed(publish | subscribe,
           mqtt_sessions_runtime:topic(),
           mqtt_packet_map:mqtt_packet(),
           z:context()) ->
              boolean().
Link to this function

is_valid_message(Msg, Options, Context)

-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.
Link to this function

new_user_context(Site, ClientId, SessionOptions)

-spec new_user_context(atom(), binary(), mqtt_sessions:session_options()) -> z:context().
-spec pool_default() -> {error, unknown_host}.
Link to this function

reauth(_, Context)

-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).
Link to this function

vhost_pool(Hostname)

-spec vhost_pool(binary()) -> {ok, atom()} | {error, unknown_host}.
Return the MQTT pool name for the given hostname.