Im developing real time chat, Im trying to overcome the multiple tabs generates unique socket id issue.
I want to delete only one socket.id from user list.
here is my users array looks like :
{
'115': [ 'HWac6RFhKhVWzByOAAAD', '0ETr8Jr0rpt64nqlAAAF' ],
'116': [ 'RrkyrEIQl78X25XLAAAB' ]
}
My code :
socket.on("disconnect", (reason) => {
console.log('user ' + socket.id + ' disconnected');
delete users[socket.id];
})
But this delete all socket.ids, i want only delete one socket id which exists to user reference.
Here userID is the id which i store all unique socket ids, when each tab opened.
I want to delete one socket id from the list which belongs to the user at a time.
How i can do that ?