ankh v0.10.0 Ankh.Protocol protocol

Protocol behavior

Link to this section Summary

Types

Protocol options

Request reference

t()

Ankh protocol

Functions

Accepts a client connection

Closes the connection

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() :: struct()

Ankh protocol

Link to this section Functions

Link to this function

accept(protocol, uri, transport, options)

Specs

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

Accepts a client connection

Link to this function

close(protocol)

Specs

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

Closes the connection

Link to this function

connect(protocol, uri, transport, options)

Specs

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

Connects to an host

Link to this function

error(protocol)

Specs

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

Reports a connection error

Link to this function

new(protocol, options)

Specs

new(t(), options()) :: {:ok, t()} | {:error, any()}

Creates a new connection

Link to this function

request(protocol, request)

Specs

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

Sends a request

Link to this function

respond(protocol, request_reference, response)

Specs

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

Sends a response

Link to this function

stream(protocol, messages)

Specs

stream(t(), any()) :: {:ok, t(), [Ankh.HTTP.msg()]} | {:error, any()}

Handles transport messages