GitHub | Documentation | Become a Patron

[How] Auto leave room



  • Hi everyone,

    i have a room with maxClients = 2 and room was locked. And i want to when have a client leave room, room will automatic dispose. How i can do this ?
    And how i can known that who was created room ? (Ex: A created room, B joined room, how i can known A created room ?)

    Thanks in adavanced.



  • Check the docs, http://colyseus.io/docs/api-room/#disconnect

    As for tracking who created it you could simply keep a variable in the room class which, if not set, you set it to the client.sessionId of the joining client in onJoin. Of course if your variable is already set you know that this is the 2nd joining player and should not use its session id.