1

Good day,

I was playing with the example found here on SO: PHP Socket Server vs node.js: Web Chat.

Using gMUD (a telnet-like client) to connect to my server, I can't seem to be able to detect when the client disconnect from the server.

Here is the two events I'm using:

socket.on('end', function() {
    console.log('end');
});

socket.on('error', function() {
    console.log('error');
});

To be honest, I thought the error event could do it. Is there any other events I'm actually missing?

Community
  • 1
  • 1
Cybrix
  • 3,248
  • 5
  • 42
  • 61

1 Answers1

5

I found it. It was abvious:

socket.on('close', function() {
    //Do something
});
Cybrix
  • 3,248
  • 5
  • 42
  • 61