Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/node/net.ts>Server#close

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method Server.prototype.close
import { Server } from "https://deno.land/std@0.127.0/node/net.ts";

Stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is finally closed when all connections are ended and the server emits a "close" event. The optional callback will be called once the "close" event occurs. Unlike that event, it will be called with an Error as its only argument if the server was not open when it was closed.

Parameters

optional
cb: (err?: Error) => void

Called when the server is closed.