Class QUICStream

Hierarchy

  • CreateDestroy
    • QUICStream

Implements

  • ReadableWritablePair<Uint8Array, Uint8Array>

Constructors

Properties

[initLock]: RWLockWriter
_readClosed: boolean = false
_writeClosed: boolean = false
closedP: Promise<void>
codeToReason: StreamCodeToReason
connection: QUICConnection
initiated: "peer" | "local"
logger: Logger
readable: ReadableStream<Uint8Array>
readableChunk?: Buffer
readableController: ReadableStreamDefaultController<any>
reasonToCode: StreamReasonToCode
rejectReadableP?: ((reason?) => void)

Type declaration

    • (reason?): void
    • Parameters

      • Optional reason: any

      Returns void

rejectWritableP?: ((reason?) => void)

Type declaration

    • (reason?): void
    • Parameters

      • Optional reason: any

      Returns void

resolveClosedP: (() => void)

Type declaration

    • (): void
    • Returns void

resolveReadableP?: (() => void)

Type declaration

    • (): void
    • Returns void

resolveWritableP?: (() => void)

Type declaration

    • (): void
    • Returns void

streamId: StreamId
type: "bidi" | "uni"
writable: WritableStream<Uint8Array>
writableController: WritableStreamDefaultController

Accessors

  • get [destroyed](): boolean
  • Returns boolean

  • get [eventHandled](): ReadonlyWeakSet<Event>
  • Returns ReadonlyWeakSet<Event>

  • get [eventHandlers](): ReadonlyMap<string, Set<EventHandlerInfo>>
  • Returns ReadonlyMap<string, Set<EventHandlerInfo>>

  • get [eventTarget](): EventTarget
  • Returns EventTarget

  • get [handleEventError](): ((evt) => void)
  • Returns ((evt) => void)

      • (evt): void
      • Parameters

        • evt: EventError

        Returns void

  • get [statusP](): Promise<Status>
  • Returns Promise<Status>

  • get [status](): Status
  • Returns Status

  • get readClosed(): boolean
  • Returns true if the readable has closed.

    Returns boolean

  • get writeClosed(): boolean
  • Returns true of the writable has closed.

    Returns boolean

Methods

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Cancels the readable and aborts the writable.

    If streams have already closed or cancelled then this will do nothing. If the underlying quiche streams already closed then this will do nothing.

    Cancellation will occur in the background.

    Parameters

    • Optional reason: any

    Returns void

    Throws

    • if cancel fails
  • Destroy the QUIC stream.

    Parameters

    • opts: {
          force?: boolean;
          reason?: any;
      } = {}
      • Optional force?: boolean

        if true, this will cancel readable and abort writable.

      • Optional reason?: any

        the reason to send to the peer, and if readable and writable is cancelled and aborted, then this will be the readable and writable error.

    Returns Promise<void>

    Throws

    • if cancel fails
  • Parameters

    • event: Event

    Returns boolean

  • Handles EventQUICStreamCloseRead. Registered once.

    Returns Promise<void>

  • Handles EventQUICStreamCloseWrite. Registered once.

    Returns Promise<void>

  • Handles EventQUICStreamError.

    This event propagates all errors relating to locally cancelling or aborting the readable or writable, or receiving a RESET_STREAM or STOP_SENDING on the readable or writable respectively.

    Internal errors will be thrown upwards to become an uncaught exception.

    Parameters

    Returns void

    Throws

  • ReadableStream ensures that this method is idempotent

    Parameters

    • Optional reason: any

    Returns void

    Throws

  • Serialised by ReadableStream.

    Returns Promise<void>

    Throws

  • Parameters

    • controller: ReadableStreamDefaultController<any>

    Returns void

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • WritableStream ensures that this method is idempotent.

    Parameters

    • Optional reason: any

    Returns void

    Throws

  • Serialised with this.writableWrite by WritableStream.

    Returns void

    Throws

  • Parameters

    • controller: WritableStreamDefaultController

    Returns void

  • Serialised with this.writableClose by WritableStream.

    Parameters

    • chunk: Uint8Array

    Returns Promise<void>

    Throws

  • Creates a QUIC stream.

    This creation is synchronous as it avoids the need for concurrent locking for generating new stream IDs.

    Parameters

    • opts: {
          codeToReason?: StreamCodeToReason;
          config: QUICConfig;
          connection: QUICConnection;
          initiated: "peer" | "local";
          logger?: Logger;
          reasonToCode?: StreamReasonToCode;
          streamId: StreamId;
      }
      • Optional codeToReason?: StreamCodeToReason

        maps stream error codes to reasons

      • config: QUICConfig

        QUIC config

      • connection: QUICConnection

        QUIC connection

      • initiated: "peer" | "local"

        local or peer initiated stream

      • Optional logger?: Logger

        The reasonToCode defaults to returning 0 as the code. The codeToReason defaults to returning Error instance.

      • Optional reasonToCode?: StreamReasonToCode

        maps stream error reasons to stream error codes

      • streamId: StreamId

        stream ID

    Returns QUICStream

Generated using TypeDoc