Serializes the async send path.
Maximum body bytes available to a single message: the outlet MDU minus the 6-byte envelope header, capped at 16 bits.
StaticSEQ_Largest sequence number (16-bit).
StaticSEQ_Sequence-number modulus (0x10000).
Decode an inbound envelope, validate its sequence, accept it into the rx ring, and deliver any newly-contiguous messages to handlers in order.
Register a system message type (MSGTYPE >= 0xf000). Library use only
(e.g. the Buffer stream layer's StreamDataMessage).
Tear the channel down: clear handlers, rings, and outlet timers/callbacks. Called on link teardown and on retry-count exhaustion.
Add a handler for incoming messages. Handlers are invoked in insertion
order; if one returns true, processing stops (later handlers are skipped).
Whether the channel can accept another send.
Open a duplex { readable, writable } pair over this channel:
readable receives receiveStreamId, writable sends sendStreamId.
See openReadable / openWritable for compression /
backpressure.
local stream id to receive at.
remote stream id to send to.
Optionaloptions: { bz2?: any }
override the link's injected bz2.
Open a ReadableStream<Uint8Array> that receives byte-stream frames
addressed to streamId. Registers StreamDataMessage as a system type
and a per-stream handler; the stream closes once an eof frame has been
delivered.
Compression: a bz2 module injected on the link (link.bz2, the same field
Resources use) decompresses inbound frames; without it a compressed frame
errors the stream.
local stream id to receive at (0–0x3fff).
Optionaloptions: { bz2?: any }
override the link's injected bz2.
Open a WritableStream<Uint8Array> that sends byte-stream frames to the
peer's streamId. Each written chunk is split into StreamDataMessage-
sized frames; backpressure follows the channel send window. close()
sends a final eof frame.
Compression: when a bz2 module is available (via options.bz2 or
link.bz2), each frame is compressed only when compression actually
shrinks it.
remote stream id to send to (0–0x3fff).
Optionaloptions: { bz2?: any }
override the link's injected bz2.
Register a message class for reception. It must extend MessageBase,
declare a valid MSGTYPE (< 0xf000), and be constructable with no args.
Remove a handler added with addMessageHandler.
Send a message reliably. Rejects if the channel is not ready (CEType.ME_LINK_NOT_READY) or the packed message exceeds the MDU (CEType.ME_TOO_BIG). Resolves with the outbound Envelope.
Reliable message channel over a ChannelOutletBase.
Obtained via
link.getChannel(); not constructed directly.