Spell.Role.Subscriber

The Spell.Role.Subscriber module implements the behaviour of the subscriber role.

Source

Summary

call_subscribe(peer, topic, options \\ [])

Send a subscribe message from peer for topic and block until a response is received or timeout

call_unsubscribe(peer, subscription)
cast_subscribe(peer, topic, options \\ [])

Subscribe peer to messages from topic

cast_unsubscribe(peer, subscription)

Asynchronously send an unsubscribe message from peer for subscription

get_features(arg1)

Callback implementation for Spell.Role.get_features/1

handle_call(arg1, arg2, peer, state)

The handle_call function is used to send SUBSCRIBE and UNSUBSCRIBE messages

handle_message(message, peer, state)

Handle SUBSCRIBED, UNSUBSCRIBED, and EVENT messages

init(peer_options, options)

Callback implementation for Spell.Role.init/2

on_close(peer, state)

Callback implementation for Spell.Role.on_close/2

on_open(peer, state)

Callback implementation for Spell.Role.on_open/2

receive_event(peer, subscription)

Helper to receive an event for the given peer and subscription

receive_unsubscribed(peer, unsubscribe)

Functions

call_subscribe(peer, topic, options \\ [])

Specs:

Send a subscribe message from peer for topic and block until a response is received or timeout.

Source
call_unsubscribe(peer, subscription)
Source
cast_subscribe(peer, topic, options \\ [])

Specs:

Subscribe peer to messages from topic.

Source
cast_unsubscribe(peer, subscription)

Specs:

Asynchronously send an unsubscribe message from peer for subscription.

Source
get_features(arg1)

Callback implementation for Spell.Role.get_features/1.

Source
handle_call(arg1, arg2, peer, state)

The handle_call function is used to send SUBSCRIBE and UNSUBSCRIBE messages.

Source
handle_message(message, peer, state)

Handle SUBSCRIBED, UNSUBSCRIBED, and EVENT messages.

Source
init(peer_options, options)

Callback implementation for Spell.Role.init/2.

Source
on_close(peer, state)

Callback implementation for Spell.Role.on_close/2.

Source
on_open(peer, state)

Callback implementation for Spell.Role.on_open/2.

Source
receive_event(peer, subscription)

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.

Source
receive_unsubscribed(peer, unsubscribe)
Source