Skip to main content
Server.prototype.once - http - Node documentation
method Server.prototype.once

Usage in Deno

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

Parameters

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

Return Type

this
Server.prototype.once(
event: "close",
listener: () => void,
): this

Parameters

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

Return Type

this
Server.prototype.once(
event: "connection",
listener: (socket: Socket) => void,
): this

Parameters

event: "connection"
listener: (socket: Socket) => void

Return Type

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

Parameters

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

Return Type

this
Server.prototype.once(
event: "listening",
listener: () => void,
): this

Parameters

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

Return Type

this
Server.prototype.once(
event: "checkContinue",
listener: RequestListener<Request, Response>,
): this

Parameters

event: "checkContinue"
listener: RequestListener<Request, Response>

Return Type

this
Server.prototype.once(
event: "checkExpectation",
listener: RequestListener<Request, Response>,
): this

Parameters

event: "checkExpectation"
listener: RequestListener<Request, Response>

Return Type

this
Server.prototype.once(
event: "clientError",
listener: (
err: Error,
socket: stream.Duplex,
) => void
,
): this

Parameters

event: "clientError"
listener: (
err: Error,
socket: stream.Duplex,
) => void

Return Type

this
Server.prototype.once(
event: "connect",
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
head: Buffer,
) => void
,
): this

Parameters

event: "connect"
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
head: Buffer,
) => void

Return Type

this
Server.prototype.once(
event: "dropRequest",
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
) => void
,
): this

Parameters

event: "dropRequest"
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
) => void

Return Type

this
Server.prototype.once(
event: "request",
listener: RequestListener<Request, Response>,
): this

Parameters

event: "request"
listener: RequestListener<Request, Response>

Return Type

this
Server.prototype.once(
event: "upgrade",
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
head: Buffer,
) => void
,
): this

Parameters

event: "upgrade"
listener: (
req: InstanceType<Request>,
socket: stream.Duplex,
head: Buffer,
) => void

Return Type

this