Class QUICClient

Hierarchy

  • CreateDestroy
    • QUICClient

Constructors

Properties

[initLock]: RWLockWriter
_closed: boolean = false
closedP: Promise<void>
config: Config
connection: QUICConnection
isSocketShared: boolean
logger: Logger
resolveClosedP: (() => void)

Type declaration

    • (): void
    • Returns void

socket: QUICSocket

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

Methods

  • Parameters

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

    Returns void

  • Destroy the QUICClient.

    Parameters

    • opts: {
          errorCode?: ConnectionErrorCode;
          force?: boolean;
          isApp: false;
          reason?: Uint8Array;
      } | {
          errorCode?: number;
          force?: boolean;
          isApp?: true;
          reason?: Uint8Array;
      } = {}

    Returns Promise<void>

  • Parameters

    • event: Event

    Returns boolean

  • Handles EventQUICClientClose. Registered once.

    This event propagates errors minus the internal errors. All QUIC connections always close with an error, even if it is a graceful.

    If this event is dispatched first before QUICClient.destroy, it represents an evented close. This could originate from the QUICSocket or QUICConnection. If it was from the QUICSocket, then here it will stop the QUICConnection with an transport code InternalError. If it was from QUICConnection, then the QUICConnection will already be closing. Therefore attempting to stop the QUICConnection will be idempotent.

    Parameters

    Returns Promise<void>

  • Handles EventQUICClientError.

    This event propagates all errors from QUICClient and QUICConnection. This means you can expect that QUICConnection errors will be logged twice.

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

    Parameters

    Returns void

    Throws

    Throws

  • Handles all EventQUICConnection events.

    Parameters

    • evt: EventAll<Event>

    Returns void

  • Handles EventQUICConnectionSend.

    This will propagate the connection send buffers to the socket. This may be concurrent and multiple send events may be processed at a time.

    Parameters

    Returns Promise<void>

  • Handles all EventQUICSocket events. Registered only if the socket is encapsulated.

    Parameters

    • evt: EventAll<Event>

    Returns void

  • Handles EventQUICSocketStopped. Registered once.

    It is an error if the socket was stopped while QUICClient wasn't destroyed.

    Returns void

  • Parameters

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

    Returns void

  • Creates a QUIC client.

    Parameters

    • opts: {
          codeToReason?: StreamCodeToReason;
          config?: Partial<QUICConfig>;
          crypto: QUICClientCrypto;
          host: string;
          ipv6Only?: boolean;
          localHost?: string;
          localPort?: number;
          logger?: Logger;
          port: number;
          reasonToCode?: StreamReasonToCode;
          resolveHostname?: ResolveHostname;
          reuseAddr?: boolean;
      }
      • Optional codeToReason?: StreamCodeToReason

        maps stream error codes to reasons

      • Optional config?: Partial<QUICConfig>

        defaults to clientDefault

      • crypto: QUICClientCrypto

        client needs to generate random bytes

      • host: string

        target host where wildcards are resolved to point locally.

      • Optional ipv6Only?: boolean

        force using IPv6 even when using ::

      • Optional localHost?: string

        defaults to :: (dual-stack)

      • Optional localPort?: number

        defaults 0

      • Optional logger?: Logger
      • port: number

        target port

      • Optional reasonToCode?: StreamReasonToCode

        maps stream error reasons to stream error codes

      • Optional resolveHostname?: ResolveHostname

        defaults to using OS DNS resolver

      • Optional reuseAddr?: boolean

        reuse existing port

    • Optional ctx: Partial<ContextTimedInput>

    Returns PromiseCancellable<QUICClient>

    Throws

    • if timed out

    Throws

    • if shared socket is not running

    Throws

    • if local host is incompatible with target host

    Throws

    • if socket start failed

    Throws

    • if connection start failed
  • Parameters

    Returns PromiseCancellable<QUICClient>

Generated using TypeDoc