-
In case the master has left the room
- In case it's still connected from other devices, nothing happens, except removing its connection
- in case there is no other connection, notifies all the players that the master has left, and start a timeout that will lead to the closing of the room.
-
In case a player has left a room
- In case it's still connected from other devices, nothing happens, except removing its connection
- In case there is no other connection, notifies the master and all the other players
- Add the connection to the master connections
- Remove, if exists, the remover callback
- Notifies all players
- Send back to the master the room details, including its word if it was playing
- In case the player was already connected from other devices, just add the connection if this new device
- Otherwise:
- notifies all other players and the master that a new player has joined
- Add him into the room
- Sends to the new player connection, the information about the players in the room, and the details of the current round
- Pick the player that will be the impostor
- Compute the words: the secret word and the impostor word.
- Send to all players the secret word
- Send to the impostor the impostor word
-
In case the master was not playing, and now is playing:
- Marks that he is now playing
- Add him to the list of player
- Notifies all the other players about a new player
- Notifies the master that a new player joined
- Notifies all master connection that he is playing
-
In case the master was playing, and now is not:
- Marks that he is not playing anymore
- Removes him from the list of player
- Notifies all the other players that a player is not playing anymore
- Notifies the master that a player has left
- Notifies all master connection that he's not playing anymore