xmpp-httpx - v0.11.0
    Preparing search index...

    Interface IbbOutStream

    XEP-0047 In-Band Bytestreams, both directions.

    Sending uses IQ-carried exclusively: each block is acknowledged by an IQ result, which provides flow control and error propagation for free. Up to window blocks are in flight at once — the result of block k is what releases block k+window — so throughput stops being one block per round trip without giving up the acks. Receiving additionally tolerates message-carried for interop.

    Ordering is preserved by construction and nowhere else: a block is taken from the buffer, base64-encoded, given its seq and handed to iqCaller in one synchronous step, and both @xmpp/connection and the mock session reach their socket write synchronously from request(). The receiver accepts no gaps (a seq jump kills the stream), so an await anywhere between taking a block and sending it would corrupt the stream rather than merely slow it.

    Unsolicited incoming s are not accepted: only sids pre-announced via expectIncoming() are. Because the announcing stanza and the can race in the event loop, an unclaimed is parked briefly (the IQ reply is simply withheld) before being refused with .

    interface IbbOutStream {
        sid: string;
        abort(reason: Error): Promise<void>;
        close(): Promise<void>;
        write(bytes: Uint8Array): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    sid: string
    • Best-effort without flushing; the local error is remembered.

      Parameters

      • reason: Error

      Returns Promise<void>

    • Flushes any buffered partial block, waits for every outstanding block to be acknowledged, and sends . Rejects with the stream's failure if any block failed — so a caller that awaits close() has the same end-to-end guarantee it had when every write awaited its own ack.

      Returns Promise<void>

    • Hands the bytes over: a sub-block remainder stays buffered by reference until a later write or close() sends it, so the caller must not mutate the array after this resolves (the same contract as a WHATWG or Node stream sink — reusing a scratch buffer between writes corrupts the tail).

      Resolves once every full block it produced has been sent, not acked: with a window > 1 those blocks are still outstanding. It still blocks while the window is full, so it remains the backpressure the callers' pump loops rely on — it just yields after window blocks instead of one. A block that fails later is reported by a subsequent write() or by close(), which waits for every outstanding ack.

      Parameters

      • bytes: Uint8Array

      Returns Promise<void>