Gamezop Publishers: Integration Docs
  • 👋Introduction
  • Getting started
    • 🤝Sign up to be a Gamezop Publisher
    • 🤩Explore our products
    • ✌️2 key terms
  • Integrate Gamezop
    • 🤌Types of integration
      • Integrate via Gamezop Unique Link
        • Add Unique Link to your website
      • Integrate via All Games API
    • 🔎Add analytics / other scripts
    • 👀Custom Unique Links for Gamezop
    • 💪Advanced guides
      • Save users' in-game progress
      • Receive user scores
        • Gamezop Leaderboards API
      • Create multiplayer experiences
        • Receive data on match winners
        • Client-side callbacks
      • Implement Android WebView
      • Implement game-events listener
  • Integrate Quizzop
    • 🔗Integrate via Quizzop Unique Link
      • Add Unique Link to your website
    • 👀Custom Unique Links for Quizzop
    • 🔎Add analytics scripts
  • Integrate Newszop
    • 🔗Integrate via Newszop Unique Link
      • Add Unique Link to your website
  • Integrate Astrozop
    • 🔗Integrate via Astrozop Unique Link
      • Add Unique Link to your website
    • 🛎️Astrozop Notifications Content API
    • 🔎Add analytics scripts
  • Integrate Criczop
    • 🔗Integrate via Criczop Unique Link
      • Add Unique Link to your website
    • 🔎Add analytics scripts
  • Integrate Performance Ad Campaigns
    • 🎯Understand Gamezop Campaign Links
    • 🔀Configure your Postback URL
  • Other Guides and APIs
    • 💰Ad Revenue Reports API
    • 🍄Custom Ad Attribution Parameters (CAAP)
    • 🤖Add Unique Link to your Android App
Powered by GitBook
On this page

Was this helpful?

  1. Integrate Gamezop
  2. Advanced guides
  3. Create multiplayer experiences

Client-side callbacks

Use client-side callbacks from our multiplayer games for analytics, or for triggering custom UI elements.

Last updated 13 days ago

Was this helpful?

We broadcast client events on the window via postMessage and on any method you provide in cta field while generating the roomDetails object.

All the data broadcasted is in the form of stringified JSON.

Events

Match found event

Trigger

This event is broadcasted when a player is matched with , and a countdown starts for the match to start.

Broadcast payload structure

{
  "event": "match_found",
  "gameCode": "game-code",
  "matchId": "match-id",
  "players": [
    "sub-1",
    "sub-2"
    ]
}

Payload notes

  • gameCode is the unique identifier for that game (you get this on the )

  • matchId is the identifier generated by your systems via the

  • players is an array of the sub identifiers you pass while generating the roomDetails object. IDs of all players matched together are passed.

No match found event

Trigger

This event is broadcasted when a player completes the for finding , but the could not be found.

Broadcast payload structure

{
  "event": "match_not_found",
  "gameCode": "game-code"
}

Payload notes

  • gameCode is the unique identifier for that game (you get this on the )

Match start event

Trigger

This event is broadcasted when the user starts playing the match. This happens after opponents are found, and the match countdown has finished.

Broadcast payload structure

{
  "event": "match_start",
  "gameCode": "game-code",
  "matchId": "match-id",
  "players": [
    {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id"
    },
     {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id"
    }
  ]
}

Payload notes

  • gameCode is the unique identifier for that game (you get this on the )

  • matchId is the identifier generated by your systems via the

  • players consists of an array of objects, each representing one of the players of that match. Within each object, firstName represents the user.name value from the that you configure. Similarly, photo in the broadcast represents the photo URL you pass for that user, and the gzpId value is the sub value you pass for that user.

Match playing event

Trigger

This event is triggered each time there is a score update for any of the players in the match. Let's say Alice and Bob are in a match, and Alice's score goes from 0 to 1, then our systems will dispatch a match_playing event on both clients, and not just on Alice's client.

Broadcast payload structure

{
  "event": "match_playing",
  "gameCode": "game-code",
  "matchId": "match-id",
  "players": [
    {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    },
     {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    }
  ]
}

Payload notes

  • All notes remain same as the match_start event above. We additionally send 2 more values for each players object: score and rank. These represent the latest score of the corresponding user, and their latest rank in the match.

Match over event

Trigger

This is broadcasted when a user is done with all their , but their opponent is still playing. In case of multiplayer games, one player may finish before another. For instance, if Alice has scored 100 and runs out of attempts, whereas Bob is still at score 90, Bob can continue playing as he still has a chance to beat Alice.

The broadcast is only made for the user that has run out of attempts, and is .

Broadcast payload structure

{
  "event": "match_over",
  "gameCode": "game-code",
  "players":  [
    {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    },
     {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    }
  ]
}

Payload notes

  • All notes remain same as the match_playing event above.

Match result event

Trigger

This event is triggered when the match is over for all players and the final results are known.

Note that in some cases, match_over and match_result may come together. Let's say Alice and Bob are playing. Alice is at score 100, and Bob is at 80. Bob runs out of attempts. Since Alice is already at a higher score, she automatically wins, even though she did not exhaust her attempts. This would trigger match_over and match_result events for both players.

Also note that match_result is broadcasted to all players in the match.

Broadcast payload structure

{
  "event": "match_result",
  "gameCode": "game-code",
  "players":  [
    {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    },
     {
      "firstName":"user-name",
      "photo":"https://www.exammple.com/photos/user-1.png",
      "gzpId":"sub-id",
      "score": 10,
      "rank: 1
    }
  ]
}

Payload notes

  • All notes remain same as the match_playing event above.

Navigate home event

Trigger

This event is broadcasted when the user taps on the option to "GO HOME" from within the game UI. You can receive this event in your app and navigate the user to your app's home screen / take any other action.

Broadcast payload structure

{
  "event": "go_home",
  "gameCode": "game-code"
}

Payload notes

gameCode is the unique identifier for that game (you get this on the )

These events above are specific to multiplayer experiences. We also broadcast events and game states in case of single-player experiences, details for which can be found .

💪
All Games API
here
All Games API
All Games API
All Games API
roomDetails object
Create Match API
Create Match API