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

Usage in Deno

import { Server } from "node:http";
Server.prototype.setTimeout(
msecs?: number,
callback?: () => void,
): this

Sets the timeout value for sockets, and emits a 'timeout' event on the Server object, passing the socket as an argument, if a timeout occurs.

If there is a 'timeout' event listener on the Server object, then it will be called with the timed-out socket as an argument.

By default, the Server does not timeout sockets. However, if a callback is assigned to the Server's 'timeout' event, timeouts must be handled explicitly.

Parameters

optional
msecs: number = 0 (no timeout)
optional
callback: () => void

Return Type

this
Server.prototype.setTimeout(callback: () => void): this

Parameters

callback: () => void

Return Type

this