Adding support for leaving the group if the socket is closed
authorDavid Négrier <d.negrier@thecodingmachine.com>
Wed, 29 Apr 2020 21:18:42 +0000 (23:18 +0200)
committerDavid Négrier <d.negrier@thecodingmachine.com>
Wed, 29 Apr 2020 21:18:42 +0000 (23:18 +0200)
back/src/Model/World.ts

index 06bcf884827ee3221a1614776bf56daefffd3b17..795cc8be9f58bee076da0e09bc067620b7d547eb 100644 (file)
@@ -34,7 +34,10 @@ export class World {
     }
 
     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);
     }