gracefully close open sockets in a http server
http-close keeps track on open sockets and closes them gracefully when the tcp server is closeing.
When you call
server.close() this moudule will:
Connection: closeto http requests where the headers is not sent
When a socket timeouts after the server is closed, this module will respond with a 500 status code and end the connection where the headers is not sent. All other sockets will be destroyed.
var http = require'http'httpClose = require'http-close'var server = httpcreateServer// Add http-close hookhttpClose timeout: 2000 server// Just call server.close as usual when you want to stop the serverserverclose
$ npm install http-close