Skip to main content
Deno.connectQuic - Deno documentation
function Deno.connectQuic
Unstable
allow-net
connectQuic<ZRTT extends boolean>(options: ConnectQuicOptions<ZRTT>): ZRTT extends true ? (QuicConn | Promise<QuicConn>) : Promise<QuicConn>

Establishes a secure connection over QUIC using a hostname and port. The cert file is optional and if not included Mozilla's root certificates will be used. See also https://github.com/ctz/webpki-roots for specifics.

const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
const conn1 = await Deno.connectQuic({ hostname: "example.com", port: 443, alpnProtocols: ["h3"] });
const conn2 = await Deno.connectQuic({ caCerts: [caCert], hostname: "example.com", port: 443, alpnProtocols: ["h3"] });

If an endpoint is shared among many connections, 0-RTT can be enabled. When 0-RTT is successful, a QuicConn will be synchronously returned and data can be sent immediately with it. Any data sent before the TLS handshake completes is vulnerable to replay attacks.

Requires allow-net permission.

Type Parameters

ZRTT extends boolean

Parameters

Return Type

ZRTT extends true ? (QuicConn | Promise<QuicConn>) : Promise<QuicConn>
Back to top