ankh v0.8.11 Ankh.Transport behaviour

Transport behavior

Link to this section Summary

Types

Transport options

t()

Transport socket

Callbacks

Accepts a client connection

Closes the connection

Connects to an host

Handles transport messages

Receives data

Sends data

Link to this section Types

Specs

options() :: Keyword.t()

Transport options

Valid options are:

  • transport_opts: Transport options for the tcp/ssl erlang modules

Specs

t() :: any()

Transport socket

Link to this section Callbacks

Link to this callback

accept(t, arg2)

Specs

accept(t(), Keyword.t()) :: {:ok, t()} | {:error, any()}

Accepts a client connection

Specs

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

Closes the connection

Link to this callback

connect(arg1, arg2)

Specs

connect(URI.t(), Keyword.t()) :: {:ok, t()} | {:error, any()}

Connects to an host

Link to this callback

handle_msg(any)

Specs

handle_msg(any()) :: {:ok, iodata()} | {:error, any()}

Handles transport messages

Link to this callback

recv(t, integer)

Specs

recv(t(), integer()) :: {:ok, iodata()} | {:error, any()}

Receives data

Link to this callback

send(t, iodata)

Specs

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

Sends data