1.0.1 • Published 6 years ago

killable v1.0.1

Weekly downloads
7,920,893
License
ISC
Repository
github
Last release
6 years ago

killable

Keeps track of a server's open sockets so they can be destroyed at a moment's notice. This way, the server connection can be killed very fast.

Installation

npm install killable

Example usage

Using express: ('server' in the example is just an http.server, so other frameworks or pure Node should work just as well.)

var killable = require('killable');

var app = require('express')();
var server;

app.route('/', function (req, res, next) {
  res.send('Server is going down NOW!');

  server.kill(function () {
    //the server is down when this is called. That won't take long.
  });
});

var server = app.listen(8080);
killable(server);

API

The killable module is callable. When you call it on a Node http.Server object, it will add a server.kill() method on it. It returns the server object.

server.kill([callback]) closes all open sockets and calls server.close(), to which the callback is passed on.

Inspired by: http://stackoverflow.com/a/14636625

License

ISC

vuedragdropuploadimages@theprojectsomething/pouchdb-server-monorepowebpack-dev-server-http2bb-chat@frxf/frxf@texttree/demo-bsa-reference-rcl@l1nyanm1ng/react-picture-viewercthpb-plugin-social@infinitebrahmanuniverse/nolb-kil@everything-registry/sub-chunk-2015pouchdb-serverqa_hdd@frontal/servervue-button-test1webpack-fs-dev-serverwebpack-serve-node6webpack-tiny-server@gem-mine/webpack-dev-serveryumi-webpack-dev-servervue-compmentvrayreact-misc-toolboxprova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4reyhan-projectreflect-servertingzi-vuepresssamc5samc2samc3samc4san-devtoolssand-httpsam-carouseltest-carosello-campusstnenopmoc-iureact-otp-input-uptdstock-ticker-react-widgetvformlmqverify-img-codevue-cli-plugin-ice-buildervue-cli-plugin-ut-builderwebpack-dev-server-sockhostwebpack-dev-server-speedywebpack-dev-server-ssrwebpack-dev-server-thinkgswebpack-dev-server-thinkjswebpack-dev-server-without-h2webpack-dev-server2webpack-dev-server-birdwebpack-dev-server-esmwebsked-webpack-dev-serverdevtools-prodesign-manual@kozakl/webpack-dev-server@kristoffertonning/vue-laravel-errorsdigital-keyboard-demosfanout-graphql-toolsfastlion-picture-viewer@mockswitch/cli@oliver_lou/webpack-dev-server2@martinjackson/simple-expressflowable-bpmn-modeler@maven-io/webpack-serve@mockoon/commons-serverdiscodip@lcooper/dev-server@ineedthis/express@kirrosh/pts@sackmanson/quill-image-uploader@procensus/webpack-dev-serverhot-zone-vue@rbc-public/react-selectable-fast@eps1lon/webpack-dev-server@ericmcornelius/easejesusdemohelp-widget@farvater/open-pedigree@elsouza1985/react-org-chart@presspage/metatrader-bridge@torgeircook/cssjson@bengo.co/typescript-web-starter@beldore/react-otp-inputng-search-dropdownb2x-utilslaqi@uvue/servercampus-carosellocampus1campus2campus3campus4caropcarop2carop3carop4carosello-campus-opacita
1.0.1

6 years ago

1.0.0

9 years ago