View Source Barytherium.Network.Sender (barytherium v0.2.0)

Genserver for sending frames, see Barytherium.Network.Sender.write/2

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Formats and writes a list of frames to the underlying socket. Always returns :ok, if there's an error condition it'll be expressed in a cast to the listener process, spec: {:barytherium, :disconnect, atom()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.

Link to this function

start_link(socket, listener_pid, network_pid, opts \\ %{})

View Source
@spec start_link(port(), pid(), pid(), map()) :: {:ok, pid()}
@spec write(pid(), [Barytherium.Frame.t()]) :: :ok

Formats and writes a list of frames to the underlying socket. Always returns :ok, if there's an error condition it'll be expressed in a cast to the listener process, spec: {:barytherium, :disconnect, atom()}

The current final atom can be either :closed or :timeout.

Note that when you use this to send a CONNECT frame, it will read the heart-beat header if set, and communicate this to the corresponding Barytherium.Network process to inform heartbeat negotiation.