How to determine if a .HttpResponse server is stopped without listening to "end" or "close" events?
What I'm trying to achieve looks something like this:
http.createServer(function (request, response) { var foo; // my event emitting object // ... something compilated happens here ... foo.onSomeEvent(function () { if (response.hasEnded) { // do something } }); });
You can check the finished property on the response object:
finished
if (res.finished) { ... }
(I never used it myself, so I'm not sure if there are any potential problems that should be considered when using it)
Source: https://habr.com/ru/post/956073/More articles:Error creating x.509 certificate - javaGet version information of the included library? - androidFree NHibernate - HasMany on a composite key - c #Perhaps a SOA cloud in PaaS? - google-app-enginePost Reply to Facebook - c #VB.NET Try / Catch / When - Stay Away or Use It? - exception-handlingIs it possible to programmatically display a visualization drawableLeft - androidAutomatically adjust the menu in the "Main Menu" menu when activating a theme - wordpressMaven Error: "Updating the Maven Project" - springHow to encode two-way duplex streams in NodeJS - node.jsAll Articles