connect - Node documentation
function connect

Usage in Deno

import { connect } from "node:http2";
connect(
authority: string | url.URL,
listener: (
socket: net.Socket | tls.TLSSocket,
) => void
,
): ClientHttp2Session

Returns a ClientHttp2Session instance.

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

// Use the client

client.close();

Parameters

authority: string | url.URL

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.

listener: (
socket: net.Socket | tls.TLSSocket,
) => void

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

Return Type

connect(
authority: string | url.URL,
listener?: (
socket: net.Socket | tls.TLSSocket,
) => void
,
): ClientHttp2Session

Parameters

authority: string | url.URL
optional
listener: (
socket: net.Socket | tls.TLSSocket,
) => void

Return Type