package atacama

  1. Overview
  2. Docs

An Atacama Handler determines how every connection handled by Atacama will behave. It defines a number of hooks for handling the state of the connection:

* `handle_close` – for when a connection is about to be closed

* `handle_connection` - to prepare the state of a connection right after it started.

* `handle_data` – to deal with data packets as they come. It is worth noting that Atacama does not determine how much to buffer, or how to read, and this is defined in the Transport module used.

* `handle_error` - to receive and handle any connection errors.

type t =
  1. | H : {
    1. handler : (module Handler.Intf with type error = 'error and type state = 'new_state);
    2. state : 'new_state;
    } -> t
type ('state, 'error) handler_result =
  1. | Ok
  2. | Continue of 'state
  3. | Continue_with_timeout of 'state * Riot.Timeout.t
  4. | Close of 'state
  5. | Error of 'state * 'error
  6. | Switch of t
module type Intf = sig ... end

The interface of an Atacama Handler. It is worth noting that you don't have to explicitly implement this interface, which allows your modules to include _more_ than is specified here.

module Default : sig ... end

Default handler methods. Useful for bootstrapping new handlers incrementally.

OCaml

Innovation. Community. Security.