Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.HttpConn

A modern runtime for JavaScript and TypeScript.
Go to Latest
interface Deno.HttpConn
implements AsyncIterable<RequestEvent>
import { type Deno } from "https://deno.land/x/deno@v1.28.3/cli/tsc/dts/lib.deno.ns.d.ts";
const { HttpConn } = Deno;

The async iterable that is returned from Deno.serveHttp which yields up RequestEvent events, representing individual requests on the HTTP server connection.

Properties

readonly
rid: number

The resource ID associated with this connection. Generally users do not need to be aware of this identifier.

Methods

nextRequest(): Promise<RequestEvent | null>

An alternative to the async iterable interface which provides promises which resolve with either a RequestEvent when there is another request or null when the client has closed the connection.

close(): void

Initiate a server side closure of the connection, indicating to the client that you refuse to accept any more requests on this connection.

Typically the client closes the connection, which will result in the async iterable terminating or the nextRequest() method returning null.