Skip to content

GamesGlobal

GamesGlobal uses the Bridge API protocol for communication between the game and the lobby. Messages are sent via window.postMessage with a specific structure.

Bridge API Message Format

All messages sent to the GamesGlobal lobby follow this structure:

typescript
{
  Id: string,        // UUID for the message
  Name: string,      // Message name (e.g., "bridge_api_ready")
  Body: object | null,
  Type: "REQUEST" | "NOTIFICATION" | "RESPONSE",
  Origin: "embeddedgame",
  SenderId: string   // window.name
}

Required Methods

The following methods are required for integration with GamesGlobal:

  • gameReady - Sends BRIDGE_API_READY message to inform the lobby the game is ready to communicate
  • playerActivity - Sends PLAYER_ACTIVITY message when the player performs an action
  • quit - Sends CLOSE_APPLICATION notification when the player requests the game be closed

Bridge API Messages

BRIDGE_API_READY

Sent when gameReady() is called. This message must be sent as soon as the game is loaded. The lobby will not send any messages to the game nor respond to any messages until this message is sent.

PLAYER_ACTIVITY

Sent when playerActivity() is called. This notifies the lobby that the player has performed an action, allowing the lobby to control session inactivity requirements for specific jurisdictions.

Examples of actions that should trigger this:

  • Clicking the spin button
  • Changing the bet/stake amount
  • Interacting with game menus or settings
  • Clicking collect/gamble buttons
  • Any touch or click input during gameplay

CLOSE_APPLICATION

Sent when quit() is called. This informs the lobby that the player has requested the game be unloaded/closed. The lobby will close the game and return to the lobby.

Usage Example

typescript
import { OperatorInterface, OperatorProtocol } from '@hoelle/operator-interface';

// Setup with GamesGlobal protocol
await OperatorInterface.setup(
  OperatorProtocol.GAMESGLOBAL,
  'game-code',
  'EUR',
  'en',
  'player123',
  'REAL',
  'https://lobby.example.com'
);

// Notify lobby that game is ready (sends BRIDGE_API_READY)
OperatorInterface.gameReady();

// Notify lobby of player activity (sends PLAYER_ACTIVITY)
OperatorInterface.playerActivity();

// Close the game (sends CLOSE_APPLICATION)
OperatorInterface.quit();