z_mqtt (zotonic_core v1.0.0-rc.12)
Link to this section Summary
Functions
Check if the MQTT client for this request context is alive.
Map subscription topic to a topic filter.
Ensure that the topic is prefixed with "bridge/origin/".
Find the Pid of the MQTT client process for this request context.
Link to this section Types
Link to this type
callback/0
-type callback() :: pid() | {module(), atom(), list()}.
Link to this type
publish_options/0
-type publish_options() :: #{retain => boolean(), qos => 0 | 1 | 2}.
Link to this type
topic/0
-type topic() :: mqtt_sessions:topic().
Link to this type
topic_any/0
-type topic_any() :: mqtt_sessions:topic() | m_rsc:resource_id() | {object, list()} | {subject, list()}.
Link to this section Functions
Link to this function
await_response(Topic, Context)
-spec await_response(mqtt_sessions:topic(), z:context()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}.
Link to this function
await_response(Topic, Timeout, Context)
-spec await_response(mqtt_sessions:topic(), pos_integer(), z:context()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}.
Link to this function
call(Msg, Context)
-spec call(mqtt_packet_map:mqtt_packet(), z:context()) -> {ok, term()} | {error, term()}.
Link to this function
call(Topic, Payload, Context)
Link to this function
flatten_topic(T)
Link to this function
is_client_alive(Context)
-spec is_client_alive(z:context()) -> boolean().
Link to this function
map_topic(Topic, Context)
-spec map_topic(mqtt_sessions:topic(), z:context()) -> {ok, mqtt_sessions:topic()} | {error, no_client | term()}.
Link to this function
map_topic_filter(Topic, Context)
Link to this function
origin_topic(Topic)
-spec origin_topic(Topic) -> OriginTopic when Topic :: mqtt_sessions:topic(), OriginTopic :: mqtt_sessions:topic().
Link to this function
publish(Msg, Context)
-spec publish(mqtt_packet_map:mqtt_packet(), z:context()) -> ok | {error, term()}.
Link to this function
publish(Topic, Payload, Context)
Link to this function
publish(Topic, Payload, Options, Context)
-spec publish(topic(), term(), publish_options(), z:context()) -> ok | {error, term()}.
Link to this function
subscribe(TopicFilter, Context)
Link to this function
subscribe(TopicFilter, Pid, Context)
Link to this function
subscribe(TopicFilter, Callback, OwnerPid, Context)
Link to this function
subscribe(TopicFilter, Callback, OwnerPid, Options, Context)
-spec subscribe(topic(), callback(), pid(), mqtt_sessions:subscriber_options(), z:context()) -> ok | {error, term()}.
Link to this function
temp_response_topic(Context)
-spec temp_response_topic(z:context()) -> {ok, mqtt_sessions:topic()} | {error, term()}.
Link to this function
unsubscribe(TopicFilter, Context)
Link to this function
unsubscribe(TopicFilter, OwnerPid, Context)
Link to this function
whereis_client(Context)
-spec whereis_client(z:context()) -> {ok, pid()} | {error, term()}.