Spell.Role.Session
The Spell.Role.Session module implements the behaviour for a session
role.
Sessions are pseudo-roles; each peer started with Spell.Connect
has Spell.Role.Session added as the first role in roles.
Summary↑
| await_welcome(peer) | Await the welcome message. Useful for blocking until the session is established |
| call_goodbye(peer, options \\ []) | Send a GOODBYE message to the remote peer and wait for the GOODBYE reply |
| cast_goodbye(peer, options \\ []) | Send a GOODBYE message to the remote peer. The remote peer should reply with a GOODBYE |
| get_features(options) | Callback implementation for |
| handle_call(arg1, arg2, peer, state) | The |
| handle_message(message, peer, state) | Handle |
| init(peer_options, options) | Returns the state with the specified realm, role, and authentication info |
| new_authenticate(signature, details) | |
| on_close(peer, state) | Callback implementation for |
| on_open(peer, state) | Send a |
| receive_welcome(peer) |
Types ↑
Functions
Specs:
- await_welcome(pid) :: {:ok, Spell.Message.t} | {:error, :timeout}
Await the welcome message. Useful for blocking until the session is established.
Specs:
- call_goodbye(pid, Keyword.t) :: {:ok, Spell.Message.t} | {:error, :timeout}
Send a GOODBYE message to the remote peer and wait for the GOODBYE reply.
This must be called from the peer’s owner, otherwise the listening process won’t receive the GOODBYE message.
Specs:
- cast_goodbye(pid, Keyword.t) :: :ok
Send a GOODBYE message to the remote peer. The remote peer should reply with a GOODBYE.
Callback implementation for Spell.Role.get_features/1.
The handle_call function is used to send GOODBYE messages.
Handle CHALLENGE, WELCOME, GOODBYE, and ABORT messages.
Returns the state with the specified realm, role, and authentication info.
peer_options :: Map.t
Specs:
- new_authenticate(String.t, %{}) :: {:ok, Spell.Message.t} | {:error, any}
Callback implementation for Spell.Role.on_close/2.
Send a HELLO message when the connection is opened.