Is there any way to disable players from joining a room?

0 votes
Hello. Is there any way to disable players from joining a room? My 2-player game creates dynamic rooms. Once the players are in game, I need to handle the game whenever one of the player loses connection. Because the room has already two players, the game has started. If a player leaves the room inside the game, the number of players inside the room becomes one again, which may allow other players who are queueing for a room to inadvertently join that room that is still inside a game. How can I disable that room from allowing other players to join it once game is in progress?
asked Apr 30, 2016 in Android by Mark Ty (20 points)

1 Answer

0 votes
 
Best answer

Hi Mark,

While creating room, you can create room with maxUser parameter 2 and a property say isGameStarted with its value as false. For joining room, you can use joinRoomWithProperties API with property isGameStarted and value false. This way the user will only be joined in a room if the value of this property is false in that room. Now, when game starts in the room, you can update the value of isGameStarted property as true. So even if one user gets disconnected from the game this property value will be still true and hence a new user will never be able to join this room.

Let me know if you have any other queries.

Thanks, 

Rajeev

 

answered May 1, 2016 by rajeev.etc (1,660 points)
selected May 2, 2016 by Mark Ty
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...