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 viasend.
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
- 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
frameto the matching stream. -
grantCredit(
int credit) → void -
Grants
creditadditional outbound bytes (from achannel.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
datato standard error (node → client). -
sendStdin(
List< int> data) → void -
Writes
datato standard input (client → node). -
sendStdout(
List< int> data) → void -
Writes
datato 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.