Phaser API Documentation

  Version: 
matchPlayer([matchTag], [switchImmediately])

Description:

Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group thread will be created containing the matched players and the player will be context switched to that thread. This plugin will also dispatch the matchplayer event, containing the new context ID and Type.

The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players are trying to get matched around the same time.

The values can be changed in fbapp-config.json. See the Bundle Config documentation for documentation about fbapp-config.json.

Parameters:

name type arguments Default description
matchTag string <optional>

Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. The tag must only include letters, numbers, and underscores and be 100 characters or less in length.

switchImmediately boolean <optional> false

Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context.

Returns:
Description:

This Facebook Instant Games Plugin instance.

Examples:
Since: 3.13.0