reticulum-js
    Preparing search index...

    Class Channel

    Reliable message channel over a ChannelOutletBase.

    Obtained via link.getChannel(); not constructed directly.

    Index
    _maxTries: number
    _messageCallbacks: ((message: MessageBase) => boolean)[]
    _messageFactories: Map<number, typeof MessageBase>
    _nextRxSequence: number
    _nextSequence: number
    _outlet: ChannelOutletBase
    _rxRing: Envelope[]
    _sendChain: Promise<void>

    Serializes the async send path (the JS analog of Python's _send_lock).

    _shutDown: boolean
    _txRing: Envelope[]
    fastRateRounds: number
    mediumRateRounds: number
    window: number
    windowFlexibility: number
    windowMax: number
    windowMin: number
    • Decode an inbound envelope, validate its sequence, accept it into the rx ring, and deliver any newly-contiguous messages to handlers in order.

      Parameters

      • raw: Uint8Array<ArrayBufferLike>

      Returns void

    • Tear the channel down: clear handlers, rings, and outlet timers/callbacks. Called on link teardown and on retry-count exhaustion.

      Returns void

    • Add a handler for incoming messages. Handlers are invoked in insertion order; if one returns true, processing stops (later handlers are skipped).

      Parameters

      Returns void

    • Open a duplex { readable, writable } pair over this channel (RNS/Buffer.py create_bidirectional_buffer): readable receives receiveStreamId, writable sends sendStreamId. See openReadable / openWritable for compression / backpressure.

      Parameters

      • receiveStreamId: number

        local stream id to receive at.

      • sendStreamId: number

        remote stream id to send to.

      • Optionaloptions: { bz2?: any }

        override the link's injected bz2.

      Returns {
          readable: ReadableStream<Uint8Array<ArrayBufferLike>>;
          writable: WritableStream<Uint8Array<ArrayBufferLike>>;
      }

    • Open a ReadableStream<Uint8Array> that receives byte-stream frames addressed to streamId (RNS/Buffer.py create_reader). 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.

      Parameters

      • streamId: number

        local stream id to receive at (0–0x3fff).

      • Optionaloptions: { bz2?: any }

        override the link's injected bz2.

      Returns ReadableStream<Uint8Array<ArrayBufferLike>>

    • Open a WritableStream<Uint8Array> that sends byte-stream frames to the peer's streamId (RNS/Buffer.py create_writer). 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 when it actually shrinks (mirroring the Python writer's segment-size search).

      Parameters

      • streamId: number

        remote stream id to send to (0–0x3fff).

      • Optionaloptions: { bz2?: any }

        override the link's injected bz2.

      Returns WritableStream<Uint8Array<ArrayBufferLike>>