Fconnect
Bun

function

http2.connect

function connect(
authority: string | URL,
listener: (session: ClientHttp2Session, socket: Socket | TLSSocket) => void

Returns a ClientHttp2Session instance.

import http2 from 'node:http2';
const client = http2.connect('https://localhost:1234');

// Use the client

client.close();
@param authority

The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the http:// or https:// prefix, host name, and IP port (if a non-default port is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.

@param listener

Will be registered as a one-time listener of the 'connect' event.

function connect(
authority: string | URL,
listener?: (session: ClientHttp2Session, socket: Socket | TLSSocket) => void

Returns a ClientHttp2Session instance.

import http2 from 'node:http2';
const client = http2.connect('https://localhost:1234');

// Use the client

client.close();
@param authority

The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the http:// or https:// prefix, host name, and IP port (if a non-default port is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.

@param listener

Will be registered as a one-time listener of the 'connect' event.