Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/cli/dts/lib.deno.unstable.d.ts>Deno.listenDatagram

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.listenDatagram
allow-net
allow-read
allow-write
import { Deno } from "https://deno.land/x/deno@v1.28.1/cli/dts/lib.deno.unstable.d.ts";
const { listenDatagram } = Deno;

UNSTABLE: New API, yet to be vetted.

Listen announces on the local transport address.

const listener1 = Deno.listenDatagram({
  port: 80,
  transport: "udp"
});
const listener2 = Deno.listenDatagram({
  hostname: "golang.org",
  port: 80,
  transport: "udp"
});

Requires allow-net permission.

Parameters

options: UdpListenOptions & { transport: "udp"; }

UNSTABLE: New API, yet to be vetted.

Listen announces on the local transport address.

const listener = Deno.listenDatagram({
  path: "/foo/bar.sock",
  transport: "unixpacket"
});

Requires allow-read and allow-write permission.

Parameters

options: UnixListenOptions & { transport: "unixpacket"; }