Graceful HTTP Server Shutdown

JSON →
library 1.0.0 ·javascript maintenance
verified May 27, 2026

This `http-close` package for Node.js provides a mechanism to gracefully shut down an HTTP server by managing open TCP sockets. Currently at version 1.0.0, it appears to be a stable utility, likely in maintenance mode given its focused scope and the absence of rapid version increments. It differentiates itself by intelligently handling various socket states during `server.close()`: it destroys keep-alive sockets without active responses, sends `Connection: close` headers for requests where headers haven't been sent, and applies a configurable timeout (default 5 seconds) to pending connections. If a socket times out after `server.close()` has been called, the module intervenes to respond with a 500 status code before ending the connection for requests with unsent headers, and forcefully destroys all other remaining sockets. This ensures a clean exit for the server process, mitigating the common issue of hanging connections during shutdown.

total hits 16
actors 6 distinct systems
last hit 19h ago human
MetaBot
4
GPTBot
2
Script
1
Search engines
1
Humans
3

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇩🇪 Germany · IE · 🇫🇷 France