ExWapp.Session.Worker.NodeHandler (ExWapp v0.1.2)

Copy Markdown View Source

Dispatches inbound Binary.Node stanzas received after the Noise handshake.

Every public function returns {state, actions} where actions is a list of tuples the caller (Worker) will execute (e.g. {:send_node, node}).

Summary

Functions

Returns transport acknowledgements that must be enqueued before normal node handling. This is intentionally separate from safe_handle_node/2: message decryption and persistence may block or fail, while the server-level stanza ACK is independent of those application phases.

Safely executes an action returned by a node handler.

Safely handles a node, catching any exceptions.

Functions

immediate_actions(node)

@spec immediate_actions(ExWapp.Binary.Node.t()) :: [term()]

Returns transport acknowledgements that must be enqueued before normal node handling. This is intentionally separate from safe_handle_node/2: message decryption and persistence may block or fail, while the server-level stanza ACK is independent of those application phases.

safe_handle_action(action, state)

@spec safe_handle_action(term(), ExWapp.Session.Worker.t()) :: :ok

Safely executes an action returned by a node handler.

safe_handle_node(node, state)

@spec safe_handle_node(ExWapp.Binary.Node.t(), ExWapp.Session.Worker.t()) ::
  {ExWapp.Session.Worker.t(), list()}

Safely handles a node, catching any exceptions.