Appearance
GamesGlobal
GamesGlobal uses the Bridge API protocol for communication between the game and the lobby. The game and the lobby exchange messages through window.postMessage.
Bridge API Message Format
Every message to the GamesGlobal lobby follows 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
To integrate with GamesGlobal, use the following methods:
gameReady- Sends theBRIDGE_API_READYmessage to tell the lobby that the game is ready to communicateplayerActivity- Sends thePLAYER_ACTIVITYmessage when the player performs an actionquit- Sends theCLOSE_APPLICATIONnotification when the player requests to close the game
Bridge API Messages
BRIDGE_API_READY
The game sends this message when it calls gameReady(). Send this message as soon as the game loads. The lobby does not send messages to the game before it receives this message. The lobby does not respond to any message before it receives this message.
PLAYER_ACTIVITY
The game sends this message when it calls playerActivity(). This message tells the lobby that the player performed an action. The lobby uses this information to control the rules for session inactivity in specific jurisdictions.
The following actions trigger this message:
- 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
The game sends this message when it calls quit(). This message tells the lobby that the player requested to close the game. The lobby closes the game. The lobby returns the player 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();