Skip to main content
interface Deno.Listener
implements AsyncIterable<Conn>
Unstable

A generic network listener for stream-oriented protocols.

Properties

readonly
addr: Addr

Return the address of the Listener.

readonly
rid: number

Return the rid of the Listener.

Methods

accept(): Promise<Conn>

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<Conn>

Methods

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.