Out-flow
eLimu Games PostMessage
Overview
eLimu Games and the parent app communicate through the postMessage
API, exchanging data and triggering actions that facilitate seamless interaction. The data structure and actions are predefined, allowing the games to inform the parent app about various states and to request actions.
eLimu Games send out data to inform you of game state or data update changes. Partners are expected to make use of this for data persistency on their end or use as they see fit.
Data Structure
The messages exchanged between the app and the games follow a consistent format:
let data = {
"action": string,
"payload": object,
}
Example update_user_data
: Sent to the parent app at some point in a stated logic to update user data on partner's end for data persistency.
const outflowData = {
"action": "update_user_data",
"payload": {
"dataKey": "kpiKey1",
"value" : 100,
};
Actions List
Key Actions and Their Payloads
Actions | Description | Payload |
---|---|---|
game_loaded | Informs the parent app that the game has finished loading. | |
close_app | Sent when the game requests to close or when a quit action is initiated. | |
open_game | Requests the parent app to close the current game and open another specified game. | |
open_chunk | For optimization Some games are broken down into sections, open_chunk opens a particular section of the game | |
update_user_data | Instructs the parent app to update the user’s data in the database. | |
open_fullgame | Opens the full version of the game when user is currently on demo version |