Rooms Co-Play API Reference

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.

FBInstant

Top level namespace for the Instant Games SDK.


room

Contains functions and properties related to the current room.


getCurrentMatchAsync()

Retrieves the current real-time match for the gameplay environment, if one exists.

Examples

FBInstant.room.getCurrentMatchAsync()
  .then(function(match) {
    ...
});
  • Returns Promise<LiveMatch>: The current live match being played in this session

LiveMatch

An instant game live match that is played in a Messenger Rooms call simultaneously by all the participants.


getID()

The unique live match ID.

Examples

FBInstant.room.getCurrentMatchAsync()
  .then(function(match) {
    console.log(match.getID());
});

Returns string: The unique live match ID.


getContextID()

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.