I'm trying to use Socket.io (with NodeJS and AngularJS) to detect when a client disconnets due to a connection drop.
I've tried catching socket.on
disconnect
connect_error
reconnect_attempt
reconnecting
but it looks like they aren't fired client-side. What am I doing wrong?
Since the connection drop is a client-side issue I expect I should be able to detect it on the client but maybe I'm wrong.
Could someone please help me? Thank you!
**EDIT:** This is the code I'm using
socket.io.timeout(1000);
console.log(socket);
socket.on("open", function(){
console.log("Connected");
});
socket.on("reconnect_attempt", function(){
console.log("Attempt");
});
socket.on("reconnecting", function(){
console.log("Reconnecting");
});
socket.on("disconnect", function(){
$log.error("Client disconnected");
});
I'm faking the connection drop trough Chrome's device mode.