Channel class

One logical, bidirectional stream multiplexed over a connection.

A channel carries three byte streams (stdin, stdout, stderr) plus channel-scoped control messages (resize, signal, eof, exit, close, window). Endpoints listen to the streams relevant to their role — a node reads stdin and writes stdout/stderr; a client reads stdout/stderr and writes stdin.

Outbound data honours a simple credit window for backpressure: a sender may have at most _credit unacknowledged bytes outstanding, replenished by the peer's channel.window messages. Writes beyond the window are queued and flushed as credit arrives.

Constructors

Channel(int id, void send(OmnyShellFrame frame))
Creates a channel with id id, sending frames via send.

Properties

closed → bool
Whether the channel has been closed.
no setter
control → Stream<ControlMessage>
Channel-scoped control messages (resize, signal, eof, exit, close, …).
no setter
hashCode → int
The hash code for this object.
no setterinherited
id → int
The channel id (unique within its connection).
final
outboxDrained → Future<void>
Completes once every queued outbound byte has been flushed to the wire (or immediately if nothing is queued). A clean close should await this before calling close, which clears the outbox — otherwise credit-gated output still waiting for the peer's window would be silently discarded (truncating large command output on exit).
no setter
queuedBytes → int
Number of bytes currently queued awaiting send credit.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stderr → Stream<Uint8List>
Inbound standard-error bytes (consumed by the client side).
no setter
stdin → Stream<Uint8List>
Inbound standard-input bytes (consumed by the node side).
no setter
stdout → Stream<Uint8List>
Inbound standard-output bytes (consumed by the client side).
no setter

Methods

close() → Future<void>
Closes the channel and its streams. Idempotent.
deliverControl(ControlMessage message) → void
Delivers an inbound channel-scoped control message.
deliverData(DataFrame frame) → void
Delivers an inbound data frame to the matching stream.
grantCredit(int credit) → void
Grants credit additional outbound bytes (from a channel.window), and flushes any queued writes that now fit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendControl(ControlMessage message) → void
Sends a channel-scoped control message.
sendStderr(List<int> data) → void
Writes data to standard error (node → client).
sendStdin(List<int> data, {void onFlushed(int sentSoFar)?}) → void
Writes data to standard input (client → node).
sendStdout(List<int> data) → void
Writes data to standard output (node → client).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

defaultWindow → const int
Initial / default per-stream send window, in bytes.