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

x/ayonli_jsext/lib.deno.d.ts>Deno.HttpConn

A JavaScript extension package for building strong and modern applications.
Latest
interface Deno.HttpConn
implements AsyncIterable<RequestEvent>, Disposable
Deprecated
Deprecated

This will be removed in Deno 2.0. See the Deno 1.x to 2.x Migration Guide for migration instructions.

import { type Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.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.