Spell.Role.Subscriber
The Spell.Role.Subscriber
module implements the behaviour
of the subscriber role.
Summary↑
call_subscribe(peer, topic, options \\ []) | Send a subscribe message from |
call_unsubscribe(peer, subscription) | |
cast_subscribe(peer, topic, options \\ []) | Subscribe |
cast_unsubscribe(peer, subscription) | Asynchronously send an unsubscribe message from |
get_features(arg1) | Callback implementation for |
handle_call(arg1, arg2, peer, state) | The |
handle_message(message, peer, state) | Handle |
init(peer_options, options) | Callback implementation for |
on_close(peer, state) | Callback implementation for |
on_open(peer, state) | Callback implementation for |
receive_event(peer, subscription) | Helper to receive an event for the given peer and subscription |
receive_unsubscribed(peer, unsubscribe) |
Functions
Specs:
- call_subscribe(pid, Spell.Message.wamp_uri, Keyword.t) :: {:ok, Spell.Message.wamp_id} | {:error, :timeout}
Send a subscribe message from peer
for topic
and block until a response is
received or timeout.
Specs:
- cast_subscribe(pid, Spell.Message.wamp_uri, Keyword.t) :: {:ok, Spell.Message.wamp_id}
Subscribe peer
to messages from topic
.
Specs:
- cast_unsubscribe(pid, Spell.Message.wamp_id) :: {:ok, Spell.Message.wamp_id} | {:error, any}
Asynchronously send an unsubscribe message from peer
for
subscription
.
Callback implementation for Spell.Role.get_features/1
.
The handle_call
function is used to send SUBSCRIBE
and UNSUBSCRIBE
messages.
Handle SUBSCRIBED
, UNSUBSCRIBED
, and EVENT
messages.
Callback implementation for Spell.Role.init/2
.
Callback implementation for Spell.Role.on_close/2
.
Callback implementation for Spell.Role.on_open/2
.
Specs:
- receive_event(pid, integer) :: {:ok, %{subscription: integer, publication: integer, details: %{}, arguments: list, arguments_kw: %{}}} | {:error, :timeout}
Helper to receive an event for the given peer and subscription.