Drives a Terminalwire.Server.Connection over a real transport. This is the
process that sits between the WebSocket endpoint and your CLI code:
- the endpoint pushes inbound binary frames in via
receive_frame/2 - the session decodes, advances the protocol state machine, and pushes
outbound frames back through the
on_sendfunction the endpoint provided - once the handshake completes, your
handlerruns (in a task) with aTerminalwire.Server.Contextto talk to the client's terminal
A GenServer so it owns the connection state and serializes frame handling (the read-pump role), while the CLI handler runs in a separate task and calls back in for synchronous requests (stdin, files) — matching the Ruby runtime's pump + waiters model.
Output is flow-controlled (the SSH/HTTP-2 window model): each output stream
has credit; emit_output/3 chunks to @max_frame and blocks the writer until
credit exists, topped up by window_adjust frames. Blocking is done by deferring
the GenServer reply (we stash from and reply once the bytes are sent), so the
session itself never blocks and keeps processing inbound frames.
The handler also gets a Terminalwire.Server.IO device set as its group leader,
so standard IO.* and libraries like Owl flow over the wire (see that module).
Summary
Functions
Returns a specification to start this module under a supervisor.
Tell the session the socket closed; it shuts the handler down.
Forward one inbound binary frame from the socket.
Start a session.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Tell the session the socket closed; it shuts the handler down.
Forward one inbound binary frame from the socket.
Start a session.
Options:
:on_send(required) — 1-arity fun pushing a binary frame to the client.:handler(required) —fun(Context.t())run after the handshake; its return value becomes the exit status (0 unless it returns an integer).:server_capabilities,:server_min,:server_max— negotiation knobs.