Skip to main content
Socket.prototype.once - net - Node documentation
method Socket.prototype.once

Usage in Deno

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

Parameters

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

Return Type

this
Socket.prototype.once(
event: "close",
listener: (hadError: boolean) => void,
): this

Parameters

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

Return Type

this
Socket.prototype.once(
event: "connectionAttempt",
listener: (
ip: string,
port: number,
family: number,
) => void
,
): this

Parameters

event: "connectionAttempt"
listener: (
ip: string,
port: number,
family: number,
) => void

Return Type

this
Socket.prototype.once(
event: "connectionAttemptFailed",
listener: (
ip: string,
port: number,
family: number,
) => void
,
): this

Parameters

event: "connectionAttemptFailed"
listener: (
ip: string,
port: number,
family: number,
) => void

Return Type

this
Socket.prototype.once(
event: "connectionAttemptTimeout",
listener: (
ip: string,
port: number,
family: number,
) => void
,
): this

Parameters

event: "connectionAttemptTimeout"
listener: (
ip: string,
port: number,
family: number,
) => void

Return Type

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

Parameters

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

Return Type

this
Socket.prototype.once(
event: "data",
listener: (data: Buffer) => void,
): this

Parameters

event: "data"
listener: (data: Buffer) => void

Return Type

this
Socket.prototype.once(
event: "drain",
listener: () => void,
): this

Parameters

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

Return Type

this
Socket.prototype.once(
event: "end",
listener: () => void,
): this

Parameters

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

Return Type

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

Parameters

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

Return Type

this
Socket.prototype.once(
event: "lookup",
listener: (
err: Error,
address: string,
family: string | number,
host: string,
) => void
,
): this

Parameters

event: "lookup"
listener: (
err: Error,
address: string,
family: string | number,
host: string,
) => void

Return Type

this
Socket.prototype.once(
event: "ready",
listener: () => void,
): this

Parameters

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

Return Type

this
Socket.prototype.once(
event: "timeout",
listener: () => void,
): this

Parameters

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

Return Type

this
Back to top