1.0.1 • Published 7 years ago

killable v1.0.1

Weekly downloads
7,920,893
License
ISC
Repository
github
Last release
7 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-2015test-carosello-campusvue-button-test1websked-webpack-dev-servervrayvue-compmentvue-cli-plugin-ice-buildervue-cli-plugin-ut-builder@cube-design/react@beldore/react-otp-input@bengo.co/typescript-web-starter@presspage/metatrader-bridge@rbc-public/react-selectable-fastjesusdemolaqistnenopmoc-iustock-ticker-react-widgettingzi-vuepress@applaud/webpack-dev-server@amokrushin/webpack-dev-server@amokrushin/webpack-serve@allesa/webpack-dev-server@alta-ng-timeago/hiamtanh-alta@carhoo/widget-dealers@cheapsteak/webpack-dev-server@dannycoates/webpack-dev-serveryumi-webpack-dev-serverwebpack-tiny-serverwebpack-fs-dev-serverwebpack-dev-server-speedywebpack-dev-server-ssrwebpack-dev-server-thinkgswebpack-dev-server-thinkjswebpack-dev-server-without-h2webpack-dev-server2webpack-dev-server-birdwebpack-dev-server-esmwebpack-dev-server-sockhostwebpack-serve-node6verify-img-codevformlmq@farvater/open-pedigree@elsouza1985/react-org-chart@gem-mine/webpack-dev-server@frontal/server@kristoffertonning/vue-laravel-errors@kozakl/webpack-dev-server@lcooper/dev-server@martinjackson/simple-express@eps1lon/webpack-dev-server@ericmcornelius/ease@mockoon/commons-server@mockswitch/cli@maven-io/webpack-serve@kirrosh/pts@ineedthis/express@oliver_lou/webpack-dev-server2@sackmanson/quill-image-uploader@procensus/webpack-dev-servermncssmockelijkmockprox-commons-serversan-devtoolssand-httpsam-carouselreact-misc-toolboxsamc2samc3samc4samc5prova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4react-otp-input-uptdnode-red-contrib-homematic-rpcnode-flex-serveng-search-dropdownnois-react-toastpouchdb-serverqa_hddreyhan-projectreflect-serverhot-zone-vuehelp-widgetlitepie-datepicker-gabemarchiom2m-chartjs-plugin-crosshairkrown_login_librarycarop
1.0.1

7 years ago

1.0.0

10 years ago