I try to develop a tchat with socket.io, when a new user is connected I add it to my array users and when disconnected I remove it from array users
When the client reloads page, it considers as a disconnection, and it gets removed,
How to avoid removing when reloading the page.
socket.on('disconnect', function(data){
/*isConnected = false;
setTimeout(function(){
if ( !isConnected )
{*/
if (!socket.username) return;
delete oUsers[socket.username];
if ( socket.sexe == "femme" ) socket.broadcast.to('boys').emit('user offline', socket.username);
else socket.broadcast.to('girls').emit('user offline', socket.username);
/* }
}, 5000);*/
});