Server.prototype.on - Node documentation
method Server.prototype.on

Usage in Deno

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

Parameters

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

Return Type

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

Parameters

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

Return Type

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

Parameters

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

Return Type

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

Parameters

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

Return Type

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

Parameters

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

Return Type

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

Parameters

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

Return Type

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

Parameters

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

Return Type

this
Server.prototype.on(
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.on(
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.on(
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.on(
event: "request",
listener: RequestListener<Request, Response>,
): this

Parameters

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

Return Type

this
Server.prototype.on(
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