You can have global variables only if you're running the server on a single-thread. If you're running on multiple threads, you can use this.presence inside the room handler (see docs for presence api) As @seiyria suggested, for preventing the same user for joining multiple rooms (or the same room) it would make more sense to authenticate the user, and check the database instead during onAuth. Cheers!