View Source mqtt_sessions (mqtt_sessions v2.6.1)
Summary
Functions
Stream the connect message - connect a MQTT session or return an error
Stream the connect message - connect a MQTT session or return an error
Handle incoming data for session. Call this after a successful connect. The session will disconnect on an illegal packet.
Return the runtime module for AUTH and other callbacks.
Set the runtime module
Limit the number of sidejobs for message dispatching.
Types
-type mqtt_msg() :: mqtt_sessions_router:mqtt_msg().
-type subscriber() :: mqtt_sessions_router:subscriber().
-type subscriber_options() :: mqtt_sessions_router:subscriber_options().
-type topic() :: mqtt_packet_map:mqtt_topic().
Functions
-spec await_response(topic()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}.
-spec await_response(topic(), pos_integer()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}; (atom(), topic()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}.
-spec find_session(session_ref()) -> {ok, pid()} | {error, notfound}.
-spec find_session(atom(), session_ref()) -> {ok, pid()} | {error, notfound}.
-spec get_user_context(session_ref()) -> {ok, term()} | {error, notfound | noproc}.
-spec get_user_context(atom(), session_ref()) -> {ok, term()} | {error, notfound | noproc}.
-spec incoming_connect(binary(), msg_options()) -> {ok, {session_ref(), binary()}} | {error, incomplete_packet} | {error, term()}.
-spec incoming_connect(atom(), binary(), msg_options()) -> {ok, {session_ref(), binary()}} | {error, incomplete_packet} | {error, term()}.
-spec incoming_data(session_ref(), binary()) -> ok | {error, wrong_connection | mqtt_packet_map:decode_error()}.
-spec publish(mqtt_packet_map:mqtt_packet(), term()) -> ok | {error, eacces | invalid_topic}.
-spec runtime() -> atom().
-spec set_runtime(atom()) -> ok.
-spec set_user_context(session_ref(), term()) -> {ok, term()} | {error, notfound | noproc}.
-spec set_user_context(atom(), session_ref(), term()) -> {ok, term()} | {error, notfound | noproc}.
-spec sidejobs_limit() -> pos_integer().
-spec sidejobs_per_session() -> pos_integer().
-spec start(application:start_type(), term()) -> {ok, pid()} | {error, term()}.
-spec stop(term()) -> ok.
Link to this function
subscribe(Pool, TopicFilter, Receiver, OwnerPid, Options, UserContext)
View Source-spec unsubscribe(topic()) -> ok | {error, notfound | invalid_topic}.
-spec update_user_context(session_ref(), fun((term()) -> term())) -> {ok, term()} | {error, notfound | noproc}.
-spec update_user_context(atom(), session_ref(), fun((term()) -> term())) -> {ok, term()} | {error, notfound | noproc}.