Regarding this specification: http://www.w3.org/TR/eventsource/
How does one close the opened connection on the server? Client-side wise it is easy, just call close()
, but what should I do on the server? Just kill it?
node.js:
http.createServer(function (req, res) {
//...
// client closes connection
res.socket.on('close', function () {
res.end();
//...
});
});
see example for implementation of SSE server in node.js:
https://github.com/Yaffle/EventSource/blob/master/nodechat/server.js