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

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

A JavaScript extension package for building strong and modern applications.
Latest
interface Deno.Listener
implements AsyncIterable<T>, Disposable
import { type Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.d.ts";
const { Listener } = Deno;

A generic network listener for stream-oriented protocols.

Type Parameters

optional
T extends Conn = Conn

Properties

readonly
addr: Addr

Return the address of the Listener.

readonly
deprecated
rid: number

Return the rid of the Listener.

Methods

accept(): Promise<T>

Waits for and resolves to the next connection to the Listener.

close(): void

Close closes the listener. Any pending accept promises will be rejected with errors.

[[Symbol.asyncIterator]](): AsyncIterableIterator<T>
ref(): void

Make the listener block the event loop from finishing.

Note: the listener blocks the event loop from finishing by default. This method is only meaningful after .unref() is called.

unref(): void

Make the listener not block the event loop from finishing.