Skip to main content
Socket.prototype.on - dgram - Node documentation
method Socket.prototype.on

Usage in Deno

import { Socket } from "node:dgram";
Socket.prototype.on(
event: string,
listener: (...args: any[]) => void,
): this

Parameters

event: string
listener: (...args: any[]) => void

Return Type

this
Socket.prototype.on(
event: "close",
listener: () => void,
): this

Parameters

event: "close"
listener: () => void

Return Type

this
Socket.prototype.on(
event: "connect",
listener: () => void,
): this

Parameters

event: "connect"
listener: () => void

Return Type

this
Socket.prototype.on(
event: "error",
listener: (err: Error) => void,
): this

Parameters

event: "error"
listener: (err: Error) => void

Return Type

this
Socket.prototype.on(
event: "listening",
listener: () => void,
): this

Parameters

event: "listening"
listener: () => void

Return Type

this
Socket.prototype.on(
event: "message",
listener: (
msg: Buffer,
rinfo: RemoteInfo,
) => void
,
): this

Parameters

event: "message"
listener: (
msg: Buffer,
rinfo: RemoteInfo,
) => void

Return Type

this