Skip to main content
Licensed
Battles callbacks let your app or website respond to matchmaking, score updates, match results, and in-game navigation. The event field identifies each callback.
Complete the shared client-side callback setup and create your Battle game link before loading the game. Then use this page for the Battles events and their payloads.

How callbacks work

Client-side callbacks run on the player’s device, so use them for things like updating your UI or recording analytics. When you need a trusted result, for example before giving out rewards, use the match outcome APIs instead.

Events

A match sends events in this order:
  1. match_found: players are matched and the countdown starts. If no match is made in time, you get match_not_found instead, and no further events.
  2. match_start: the countdown ends and the match begins.
  3. match_playing: sent each time any player’s score changes, so many times during a match.
  4. match_over: the player’s own game has finished.
  5. match_result: the match has ended and the final ranking is known.
  6. go_home: only if the user taps the Go Home button.
TriggerSent when the player is matched with opponents and the countdown before the match starts.Example payload
Payload notesThis event lists the matched players in puids, rather than in players.
TriggerSent when the player reaches the end of the for finding , but the of opponents needed to start the match could not be found.Example payload
TriggerSent when the countdown ends and the player starts playing the match.Example payload
Payload notesplayers doesn’t include score or rank yet, since the match has only just started.
TriggerSent each time any player’s score changes. For example, if Alice’s score goes from 0 to 1, both Alice and Bob receive match_playing.Example payload
TriggerSent when a player’s game finishes. This happens either when they run out of attempts, or when the match ends while they’re still playing because the final ranking can no longer change. Every player receives match_over once, before match_result.If the ranking can still change when a player finishes, they see the waiting screen until the match ends.Example payload
TriggerSent to every player when the match ends, which is as soon as the final ranking can no longer change. This can happen before every player has used their attempts.For example, Alice and Bob are playing, with Alice on 100 and Bob on 80. Bob runs out of attempts. Alice has already won, so the match ends. Both players get match_over, Bob because he ran out of attempts and Alice because her game was stopped, and then both get match_result.Example payload

Payload fields

Depending on the platform, your callback handler receives each payload as an object or a JSON string. The examples above show the decoded JSON. Not every field appears in every event, so ignore any fields you don’t recognise instead of rejecting the payload.