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.

Source

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 Spell.Role.get_features/1

handle_call(arg1, arg2, peer, state)

The handle_call function is used to send GOODBYE messages

handle_message(message, peer, state)

Handle CHALLENGE, WELCOME, GOODBYE, and ABORT messages

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 Spell.Role.on_close/2

on_open(peer, state)

Send a HELLO message when the connection is opened

receive_welcome(peer)

Types

t :: %Spell.Role.Session{realm: String.t, authentication: Keyword.t, session: integer, auth_lookup: term, details: term, pid_goodbye: term, pid_hello: term, roles: term}

Functions

await_welcome(peer)

Specs:

Await the welcome message. Useful for blocking until the session is established.

Source
call_goodbye(peer, options \\ [])

Specs:

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.

Source
cast_goodbye(peer, options \\ [])

Specs:

Send a GOODBYE message to the remote peer. The remote peer should reply with a GOODBYE.

Source
get_features(options)

Callback implementation for Spell.Role.get_features/1.

Source
handle_call(arg1, arg2, peer, state)

The handle_call function is used to send GOODBYE messages.

Source
handle_message(message, peer, state)

Handle CHALLENGE, WELCOME, GOODBYE, and ABORT messages.

Source
init(peer_options, options)

Returns the state with the specified realm, role, and authentication info.

  • peer_options :: Map.t
Source
new_authenticate(signature, details)

Specs:

Source
on_close(peer, state)

Callback implementation for Spell.Role.on_close/2.

Source
on_open(peer, state)

Send a HELLO message when the connection is opened.

Source
receive_welcome(peer)
Source