Skip to main content

listen

function Deno.listen
allow-net
allow-read
allow-write
Jump to headinglisten(options: TcpListenOptions & { transport?: "tcp"; }): TcpListener

Listen announces on the local transport address.

const listener1 = Deno.listen({ port: 80 })
const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });

Requires allow-net permission.

Parameters Jump to heading

Jump to headingoptions: TcpListenOptions & { transport?: "tcp"; }

Return Type Jump to heading

Jump to headinglisten(options: UnixListenOptions & { transport: "unix"; }): UnixListener

Listen announces on the local transport address.

const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" })

Requires allow-read and allow-write permission.

Parameters Jump to heading

Jump to headingoptions: UnixListenOptions & { transport: "unix"; }

Return Type Jump to heading

Back to top