Skip to content

Http3ClientConnection

Defined in: packages/net-http/src/h3/http3-client-connection.ts:71

Sends HTTP/3 requests over one QUIC connection, each on its own stream, concurrently up to the server’s stream limit; a request beyond it waits for a stream to close.

Aborting a request cancels its stream only, and so does cancelling its response body. After the server’s GOAWAY, requests it will not process fail with HttpConnectionError and may be retried on a new connection.

Prefer HttpAgent, which opens and reuses connections per origin; this class is the per-connection piece.

new Http3ClientConnection(options): Http3ClientConnection

Defined in: packages/net-http/src/h3/http3-client-connection.ts:76

Http3ClientConnectionOptions

Http3ClientConnection

EventDispatcherMapBase<Http3ClientConnectionEvents>.constructor

get activeStreams(): number

Defined in: packages/net-http/src/h3/http3-client-connection.ts:103

Request streams currently open.

number


get reusable(): boolean

Defined in: packages/net-http/src/h3/http3-client-connection.ts:98

Whether the connection may carry new requests at all.

boolean

close(): Promise<void>

Defined in: packages/net-http/src/h3/http3-client-connection.ts:211

Let the open requests finish, then close.

Promise<void>

Resolves once the connection closed.


destroy(error?): void

Defined in: packages/net-http/src/h3/http3-client-connection.ts:217

Close at once, failing every request in progress.

unknown

void


extendedConnectEnabled(): Promise<boolean>

Defined in: packages/net-http/src/h3/http3-client-connection.ts:113

Whether the server accepts extended CONNECT (request.protocol), once its SETTINGS arrived.

Promise<boolean>

When the connection closed first.


isSubscribed<K>(event, listener): boolean

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:38

Check if a callback is subscribed to a specific event.

K extends keyof Http3ClientConnectionEvents

K

The event name.

Callable<Http3ClientConnectionEvents[K]>

The callback to check.

boolean

EventDispatcherMapBase.isSubscribed


request(request, options?): Promise<HttpIncomingResponse>

Defined in: packages/net-http/src/h3/http3-client-connection.ts:127

Send a request on a new stream and resolve with its response head; the body follows as the response’s stream.

HttpOutgoingRequest

HttpRequestOptions

Promise<HttpIncomingResponse>

When the connection is closing or closed, or the server will not process the request (GOAWAY, H3_REQUEST_REJECTED).

When request.protocol is set with a method other than CONNECT, or the server did not enable extended CONNECT.


subscribe<K>(event, listener, options?): Callable | null

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:23

K extends keyof Http3ClientConnectionEvents

K

Callable<Http3ClientConnectionEvents[K]>

EventDispatcherSubscribeOptions

Callable | null

EventDispatcherMapBase.subscribe


unsubscribe<K>(event, listener): void

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:31

Unsubscribe a callback from a specific event.

K extends keyof Http3ClientConnectionEvents

K

The event name.

Callable<Http3ClientConnectionEvents[K]>

The callback to remove.

void

EventDispatcherMapBase.unsubscribe


wait<K>(event, options?): Promise<Http3ClientConnectionEvents[K]>

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:45

Wait for the next occurrence of a specific event, optionally matching a predicate.

This is a convenience method that subscribes to the dispatcher, waits for the next event that matches the predicate (if provided), and then unsubscribes automatically.

K extends keyof Http3ClientConnectionEvents

K

The event name to wait for.

EventDispatcherWaitOptions<Http3ClientConnectionEvents[K]>

Optional settings including predicate and abort signal.

Promise<Http3ClientConnectionEvents[K]>

A promise that resolves with the event arguments as an array.

EventDispatcherMapBase.wait