View Source mqtt_sessions_router (mqtt_sessions v2.2.1)
Link to this section Summary
Link to this section Types
-type mqtt_msg() :: #{pool => atom(), topic => [binary()], topic_bindings => [proplists:property()], message => mqtt_packet_map:mqtt_packet(), publisher_context => term(), subscriber_context => term(), no_local => boolean(), qos => 0 | 1 | 2, retain_as_published => boolean(), retain_handling => integer()}.
-type subscriber() :: {pid() | mfa(), OwnerPid :: pid(), subscriber_options()}.
-type subscriber_options() ::
#{subscriber_context => term(),
no_local => boolean(),
qos => 0 | 1 | 2,
retain_as_published => boolean(),
retain_handling => integer()}.
Link to this section Functions
-spec info(atom()) -> list().
-spec init([atom()]) -> {ok, #state{}}.
-spec name(atom()) -> atom().
-spec publish(atom(), list(), mqtt_packet_map:mqtt_packet()) -> {ok, pid() | undefined} | {error, overload}.
-spec publish(atom(), list(), mqtt_packet_map:mqtt_packet(), term()) -> {ok, pid() | undefined} | {error, overload}.
-spec start_link(atom()) -> {ok, pid()} | {error, term()}.
-spec subscribe(atom(), list(), mqtt_sessions:callback(), term()) -> ok | {error, invalid_subscriber}.
Link to this function
subscribe(Pool, TopicFilter, Subscriber, OwnerPid, Options, SubscriberContext)
View Source-spec unsubscribe(atom(), list(), pid()) -> ok | {error, notfound}.
-spec unsubscribe_pid(atom(), pid()) -> ok.