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:match_found: players are matched and the countdown starts. If no match is made in time, you getmatch_not_foundinstead, and no further events.match_start: the countdown ends and the match begins.match_playing: sent each time any player’s score changes, so many times during a match.match_over: the player’s own game has finished.match_result: the match has ended and the final ranking is known.go_home: only if the user taps the Go Home button.
Match found (match_found)
Match found (match_found)
TriggerSent when the player is matched with opponents and the countdown before the match starts.Example payloadPayload notesThis event lists the matched players in
puids, rather than in players.No match found (match_not_found)
No match found (match_not_found)
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
Match started (match_start)
Match started (match_start)
TriggerSent when the countdown ends and the player starts playing the match.Example payloadPayload notes
players doesn’t include score or rank yet, since the match has only just started.Match score updated (match_playing)
Match score updated (match_playing)
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 payloadPlayer finished the match (match_over)
Player finished the match (match_over)
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 payloadMatch results available (match_result)
Match results available (match_result)
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