I am in the process of adding a new feature in our game. I would like to give the option for the players to invite their friends to join a room.
The exact description of the feature goes like this: Player A creates a room and invites player B to join, player B has to satisfy these conditions in order to see the invitation: 1. Is a facebook friend of player A. 2. Is online and inside the lobby.
The approach i'm following to do this is as follows: I am using PlayFab to save players data and online status. The first time a user logs in using Facebook, a PlayFab record for this player is created, this entry includes the list of Facebook friends and online status among other data (online status for each player is updated using OnDisconnectedFromPhoton and OnJoinedLobby callbacks)
When player A clicks the invite button inside the room, the list of his online friends is shown (get list of Facebook friends -->check PlayFab records to retrieve their online status --> show Facebook friends who are online). Then the player selects the friends who they want to invite.
This is the part I am having a difficulty with. Is there a way to send the invitation message to this player in the lobby which includes the room number and the invited userId? For example I am thinking about sending the message to all players in the lobby and then only show it to player B (show the message if the userId included in the message == player B userId). But I am hoping there is a more efficient solution because it looks like an overkill to send a message to all players in the lobby every time an invitation is sent!
Can you think of a better approach to do this?