setTimeout

fun setTimeout(msecs: Number = definedExternally, callback: () -> Unit = definedExternally)(source)

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.

Since

v0.9.12

Parameters

msecs=0 (no timeout)


fun setTimeout(callback: () -> Unit)(source)