How can I determine if server.HttpResponse stopped without listenng to "end" or "close" events?
What I am trying to achieve is 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:
if (res.finished) {
...
}
(never used it myself, so not sure if there are any potential problems to take into consideration when using it)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With