When making requests in Node.JS to another HTTP server, you can listen for when the server closes the connection with request.on('close', function(){});. I've been searching for similar functionality within Node's http.createServer(). I assumed that that request variable passed in to the callback had an on() function which I could call to listen for when the client closes the connection.
var http = require('http');
http.createServer(function(req, res) {
req.on('close', function() { console.log("Connection closed"); });
}).listen(80, '127.0.0.1');
However, after reading the 0.4.9 docs on streams, I noticed that under the close event it said:
Not all streams will emit this. (For example, an incoming HTTP request will not emit 'close'.)
Is there a way to listen for client connection terminations from the server in Node?