Skip to main content
Socket.prototype.on - node__dgram.d.ts - Node documentation
method Socket.prototype.on

Usage in Deno

```typescript import { Socket } from "node:node__dgram.d.ts"; ```
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