Skip to content

Entrypoint (Cocos)

The entrypoint is “how the player got into this session”. A fresh launch looks different from a notification‑tap looks different from a friend’s game‑invite. If you handle this well, players land exactly where they meant to go.

async onGameReady() {
  const name = await FRVRSDK.instance.getEntrypointName();
  const data = await FRVRSDK.instance.getEntrypointData();

  switch (name) {
    case 'notification_tap':
      // Player clicked a push. data.deepLink tells us where they wanted to go.
      this.router.go(data.deepLink ?? 'home');
      break;

    case 'game_invite':
      // Friend invited the player to a specific lobby.
      this.joinLobby(data.lobbyId);
      break;

    case 'share':
      // Player clicked through someone's shared run.
      this.startChallenge(data.seed, data.challengeId);
      break;

    default:
      this.router.go('home');
  }
}

if (data?.level) goToLevel(data.level);
  • getEntrypointName() returns a short channel‑supplied string like 'notification_tap', 'game_invite', 'share', 'direct', 'home'.
  • getEntrypointData() returns the arbitrary JSON payload attached when the entry was created (from a share sheet, a scheduled push, an invite, …).

Treat the payload as untrusted input — it comes from another client (or from channel URL params). Validate before you use it.

name === 'direct' / 'home' / null all mean “the player just launched the game”. Route them to your normal start screen.