Module z_mqtt

Interface to MQTT pubsub functionality.

Copyright © 2013-2018 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Interface to MQTT pubsub functionality

Data Types

callback()

callback() = pid() | {module(), atom(), list()}

publish_options()

publish_options() = #{retain => boolean(), qos => 0 | 1 | 2}

topic()

topic() = mqtt_session:topic()

topic_any()

topic_any() = mqtt_sessions:topic() | m_rsc:resource_id() | {object, list()} | {subject, list()}

Function Index

await_response/2
await_response/3
call/2
call/3
flatten_topic/1
is_client_alive/1Check if the MQTT client for this request context is alive.
map_topic/2
map_topic_filter/2Map subscription topic to a topic filter.
origin_topic/1
publish/2
publish/3
publish/4
subscribe/2
subscribe/3
subscribe/4
subscribe/5
temp_response_topic/1
unsubscribe/2
unsubscribe/3
whereis_client/1Find the Pid of the MQTT client process for this request context.

Function Details

await_response/2

await_response(Topic::mqtt_sessions:topic(), Context::z:context()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}

await_response/3

await_response(Topic::mqtt_sessions:topic(), Timeout::pos_integer(), Context::z:context()) -> {ok, mqtt_packet_map:mqtt_packet()} | {error, timeout}

call/2

call(Msg::mqtt_packet_map:mqtt_packet(), Context::z:context()) -> {ok, term()} | {error, term()}

call/3

call(Topic::topic(), Payload::term(), Context::z:context()) -> {ok, term()} | {error, term()}

flatten_topic/1

flatten_topic(T) -> any()

is_client_alive/1

is_client_alive(Context::z:context()) -> boolean()

Check if the MQTT client for this request context is alive.

map_topic/2

map_topic(Topic::mqtt_sessions:topic(), Context::z:context()) -> {ok, mqtt_sessions:topic()} | {error, no_client}

map_topic_filter/2

map_topic_filter(Topic::topic_any(), Context::z:context()) -> topic()

Map subscription topic to a topic filter.

origin_topic/1

origin_topic(Topic) -> any()

publish/2

publish(Msg::mqtt_packet_map:mqtt_packet(), Context::z:context()) -> ok | {error, term()}

publish/3

publish(Topic::topic(), Payload::term(), Context::z:context()) -> ok | {error, term()}

publish/4

publish(Topic::topic(), Payload::term(), Options::publish_options(), Context::z:context()) -> ok | {error, term()}

subscribe/2

subscribe(TopicFilter::topic(), Context::z:context()) -> ok | {error, term()}

subscribe/3

subscribe(TopicFilter::topic(), Pid::pid(), Context::z:context()) -> ok | {error, term()}

subscribe/4

subscribe(TopicFilter::topic(), Callback::callback(), OwnerPid::pid(), Context::z:context()) -> ok | {error, term()}

subscribe/5

subscribe(TopicFilter::topic(), Callback::callback(), OwnerPid::pid(), Options::mqtt_sessions:subscriber_options(), Context::z:context()) -> ok | {error, term()}

temp_response_topic/1

temp_response_topic(Context::z:context()) -> {ok, mqtt_sessions:topic()} | {error, term()}

unsubscribe/2

unsubscribe(TopicFilter::topic(), Context::z:context()) -> ok | {error, term()}

unsubscribe/3

unsubscribe(TopicFilter::topic(), OwnerPid::pid(), Context::z:context()) -> ok | {error, term()}

whereis_client/1

whereis_client(Context::z:context()) -> {ok, pid()} | {error, term()}

Find the Pid of the MQTT client process for this request context.


Generated by EDoc