ankh v0.8.6 Ankh.Protocol behaviour

Protocol behavior

Link to this section Summary

Types

Protocol options

Request reference

t()

Ankh protocol

Callbacks

Accepts a client connection

Closes the connection

Connects to an host

Reports a connection error

Creates a new connection

Sends a request

Handles transport messages

Link to this section Types

Specs

options() :: Keyword.t()

Protocol options

Link to this type

request_ref()

Specs

request_ref() :: reference()

Request reference

Specs

t() :: any()

Ankh protocol

Link to this section Callbacks

Link to this callback

accept(t, arg2, arg3, arg4)

Specs

accept(t(), URI.t(), Ankh.Transport.t(), Ankh.Transport.options()) ::
  {:ok, t()} | {:error, any()}

Accepts a client connection

Specs

close(t()) :: :ok | {:error, any()}

Closes the connection

Link to this callback

connect(t, arg2, arg3)

Specs

connect(t(), URI.t(), Ankh.Transport.options()) :: {:ok, t()} | {:error, any()}

Connects to an host

Specs

error(t()) :: {:ok, t()}

Reports a connection error

Specs

new(options()) :: t()

Creates a new connection

Link to this callback

request(t, arg2)

Specs

request(t(), Ankh.HTTP.Request.t()) ::
  {:ok, t(), request_ref()} | {:error, any()}

Sends a request

Link to this callback

respond(t, request_ref, arg3)

Specs

respond(t(), request_ref(), Ankh.HTTP.Response.t()) ::
  {:ok, t()} | {:error, any()}

Sends a response

Specs

stream(t(), any()) :: {:ok, binary(), t()} | {:error, any()}

Handles transport messages