Adding support for leaving the group if the socket is closed

This commit is contained in:
David Négrier 2020-04-29 23:18:42 +02:00
parent bf0fa516d4
commit c778afcbca

View File

@ -34,7 +34,10 @@ export class World {
} }
public leave(user : ExSocketInterface){ public leave(user : ExSocketInterface){
/*TODO leaver user in group*/ let userObj = this.users.get(user.id);
if (userObj !== undefined && typeof userObj.group !== 'undefined') {
this.leaveGroup(user);
}
this.users.delete(user.userId); this.users.delete(user.userId);
} }