Keep in mind that many standard Instant Game features are not available in a Room environment, including the following: Monetization APIs, Context changing APIs, Game Switch API, Custom Updates API, Custom Sharing API, Create Shortcut API.
Contains functions and properties related to the current room.
Retrieves the current real-time match for the gameplay environment, if one exists.
Examples
FBInstant.room.getCurrentMatchAsync() .then(function(match) { ... });
LiveMatch
>: This Promise will resolve with a Live Match object if one is present for the current environment, or reject with a relevant error code if there is no current Live Match for the player or environment. An instant game live match that is played in a Messenger Rooms call simultaneously by all the participants.
The unique live match ID.
Examples
FBInstant.room.getCurrentMatchAsync() .then(function(match) { console.log(match.getID()); });
Returns string: The unique live match ID.
Gets the unique context ID that is associated with this live match.
Examples
FBInstant.room.getCurrentMatchAsync() .then(function(match) { console.log(match.getContextID()); });
Returns string: The context ID for this live match.
Gets the current status of the live match, for example: PENDING, ABANDONED, CONCLUDED, RUNNING.
Examples
FBInstant.room.getCurrentMatchAsync() .then(function(match) { match.getStatusAsync().then(status => console.log(status)); });
Returns Promise<LiveMatchStatusType
>: A promise of the current state of the Live Match on the platform (e.g. one of the Match State values enumerated above)
Retrieves a list of players currently active in the match.
Examples
FBInstant.room.getCurrentMatchAsync() .then(function(match) { match.getActiveParticipantsAsync().then(activeParticipants => GameMatch.updatePlayers(activeParticipants)) });
Returns Promise<Array<LiveMatchPlayer
>>: A promise that resolves with a list of live match player objects.
Represents information about a player who is a participant in a real-time match.
Gets the ID of the live match player.
Returns string: The ID of the live match player.
Gets the player's display name.
Returns string: The player's display name.
Gets the player's public profile photo.
Returns string: A URL to the player's public profile photo