0

Is there a way to detect when a client disconnect from the server side?

app.js

ss.event.on("close",function(session){

console.log(client disconnected); });

thanks

1 Answers1

0

Check these two:

req.on("close", function() {
  // request closed unexpectedly
});

req.on("end", function() {
  // request ended normally
}):
Federico Lenzi
  • 1,632
  • 4
  • 18
  • 34
  • great, check the documentation to see each event from the clases. http://nodejs.org/api/index.html – Federico Lenzi Oct 21 '12 at 18:50
  • what I want to do it's keep a online user list updated, so i guess i have to use the two events. – Henrique E Mota Oct 21 '12 at 18:52
  • Could you get this to work anyhow? Federico's link has nothing to do with SocketStream, and `req` has no `on` member, and `ss` has no `event` member either. Is this about SS0.3? – kaoD Oct 30 '12 at 08:39
  • @HenriqueEMota after some fiddling I figured you meant HTTP router's req. Unfortunately, req ends/closes as soon as the main view is sent, so it won't work for me. How did you get it to work? – kaoD Oct 30 '12 at 18:48