tortoise v0.10.0 Tortoise.Transport behaviour View Source

Abstraction for working with network connections; this is done to normalize the :ssl and :gen_tcp modules, so they get a similar interface.

This work has been heavily inspired by the Ranch project by NineNines.

Link to this section Summary

Functions

Create a new Transport specification used by the Connection process to log on to the MQTT server. This allow us to filter the options passed to the connection type, and guide the user to connect to the individual transport type

Link to this section Types

Link to this section Functions

Link to this function new(arg) View Source
new({atom(), [term()]}) :: t()

Create a new Transport specification used by the Connection process to log on to the MQTT server. This allow us to filter the options passed to the connection type, and guide the user to connect to the individual transport type.

Link to this section Callbacks

Link to this callback accept(socket, timeout) View Source
accept(socket(), timeout()) ::
  {:ok, socket()} | {:error, :closed | :timeout | atom()}
Link to this callback accept_ack(socket, timeout) View Source
accept_ack(socket(), timeout()) :: :ok
Link to this callback close(socket) View Source
close(socket()) :: :ok
Link to this callback connect(charlist, arg1, opts, timeout) View Source
connect(charlist(), :inet.port_number(), opts(), timeout()) ::
  {:ok, socket()} | {:error, atom()}
Link to this callback controlling_process(socket, pid) View Source
controlling_process(socket(), pid()) ::
  :ok | {:error, :closed | :now_owner | atom()}
Link to this callback getopts(socket, list) View Source
getopts(socket(), [atom()]) :: {:ok, opts()} | {:error, atom()}
Link to this callback getstat(socket) View Source
getstat(socket()) :: {:ok, stats()} | {:error, atom()}
Link to this callback getstat(socket, list) View Source
getstat(socket(), [atom()]) :: {:ok, stats()} | {:error, atom()}
Link to this callback listen(opts) View Source
listen(opts()) :: {:ok, socket()} | {:error, atom()}
Link to this callback peername(socket) View Source
peername(socket()) ::
  {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, atom()}
Link to this callback recv(socket, non_neg_integer, timeout) View Source
recv(socket(), non_neg_integer(), timeout()) ::
  {:ok, any()} | {:error, :closed | :timeout | atom()}
Link to this callback send(socket, iodata) View Source
send(socket(), iodata()) :: :ok | {:error, atom()}
Link to this callback setopts(socket, opts) View Source
setopts(socket(), opts()) :: :ok | {:error, atom()}
Link to this callback shutdown(socket, arg1) View Source
shutdown(socket(), :read | :write | :read_write) :: :ok | {:error, atom()}
Link to this callback sockname(socket) View Source
sockname(socket()) ::
  {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, atom()}