FIX.Session.Transport behaviour (fix_session v0.1.2)

Copy Markdown View Source

Transport contract for initiator sessions.

Implementations move bytes and nothing else: they must not parse or interpret FIX messages. The session process is the controlling process for the socket; connect/4 must return a passive socket, and the session re-arms delivery with set_active_once/1 only after it has processed each socket event, so socket messages and sequence transitions stay serialized.

Summary

Types

host()

@type host() :: binary() | charlist() | :inet.ip_address()

socket()

@type socket() :: term()

Callbacks

close(socket)

@callback close(socket()) :: :ok

connect(host, port_number, options, timeout)

@callback connect(host(), :inet.port_number(), options :: keyword(), timeout()) ::
  {:ok, socket()} | {:error, term()}

send(socket, iodata)

@callback send(socket(), iodata()) :: :ok | {:error, term()}

set_active_once(socket)

@callback set_active_once(socket()) :: :ok | {:error, term()}