Xirsys.Sockets.Conn (xturn_sockets v2.2.0)

View Source

Transport-level connection context passed to handlers.

Built by Connection (streams) or DatagramServer (datagrams). Handlers read addresses and assigns; they do not own the socket.

iex> conn = %Xirsys.Sockets.Conn{client_ip: {127, 0, 0, 1}, client_port: 3478}
iex> conn.client_port
3478
iex> conn.assigns
%{}

Summary

Types

t()

Connection context.

Types

t()

@type t() :: %Xirsys.Sockets.Conn{
  assigns: map(),
  client_ip: :inet.ip_address() | nil,
  client_port: :inet.port_number() | nil,
  listener: pid() | nil,
  server_ip: :inet.ip_address() | nil,
  server_port: :inet.port_number() | nil,
  socket: term()
}

Connection context.

  • listener - Acceptor / DatagramServer pid, if any
  • socket - opaque transport socket
  • client_ip / client_port - peer (updated per datagram on UDP)
  • server_ip / server_port - local bind address
  • assigns - caller-supplied map, unchanged by the engine