You can subscribe to in-game RubyPlay messages using postMessage API functionality.
Messages from the game are sent to the parent page. Each message has a standard structure and contains the following fields:
{
type: string;
sender: string;
lang: string;
data?: any;
}typeis a string with a specific structurerp.g2w.RedirectToLobbywhere:rpis an abbreviation of RubyPlayg2wis a direction for notification - from game to wrapperRedirectToLobbyis a message name
senderis a string with an ID code of the game from which the notification is being sentlangis a string with a language codedatafield is not mandatory and contains any additional data
Click here to see message examples...
Here are some examples:
{"type":"rp.g2w.payTableStatusUpdate","sender":"rp_34","lang":"en","data":{"isOpen":false}}
{"type":"rp.g2w.payTableStatusUpdate","sender":"rp_34","lang":"en","data":{"isOpen":true}}
{"type":"rp.g2w.gameRulesStatusUpdate","sender":"rp_25","lang":"da","data":{"isOpen":false}}
{"type":"rp.g2w.gameRulesStatusUpdate","sender":"rp_25","lang":"da","data":{"isOpen":true}}
{"type":"rp.g2w.paidRoundEnded","sender":"rp_76","lang":"en","data":{"win":0,"totalWin":0,"isBigWin":false}}
{"type":"rp.g2w.balanceUpdate","sender":"rp_34","lang":"en","data":{"balance":999620}}
{"type":"rp.g2w.paidRoundStarted","sender":"rp_54","lang":"es"}The full list of messages that the game can send:
The rp.g2w.systemPopup message is sent whenever a system popup is shown or closed (e.g. errors, session timers, inactivity timers).
Message structure:
{
shown: boolean;
type: string;
message?: string;
}The type field can have one of the following values:
Values are grouped by category to improve readability.
SLOW_CONNECTIONCONNECTION_TIMEOUTCONNECTION_ERRORLOST_CONNECTION
GAME_UNAVAILABLEGAME_DISABLED
INSUFFICIENT_FUNDSINSUFFICIENT_PROMOTION_BALANCELOW_BALANCE_ERROR
SESSION_EXPIREDSESSION_TIME_LIMIT_REACHEDUNRESOLVED_SESSIONINACTIVITY_TIMER
PLAYER_BLOCKEDBET_PLACEBROKEN_ROUND
BROWSER_NOT_SUPPORTEDWEBGL_CAN_NOT_SUPPORTEDUNAVAILABLE_LOCATION
PROMOTION_TERMINATED_WARNINGPROMOTION_TERMINATED_ERROR
Click here to see an example...
{
"type": "rp.g2w.systemPopup",
"sender": "rp_34",
"lang": "en",
"data": {
"shown": true,
"type": "INSUFFICIENT_FUNDS",
"message": "Not enough balance to place a bet"
}
}For this functionality, the casino must use the postMessage API and adhere to the following fields:
{
type: string;
data?: any;
}typeis a string with a specific structurerp.w2g.refreshBalancewhere:rpis an abbreviation of RubyPlayw2gis a direction for notification - from wrapper to gamerefreshBalanceis a message name
datafield is not mandatory and contains any additional data
IMPORTANT: The entire message must be a JSON object. For example:
{"type":"rp.w2g.refreshBalance"}The list of messages that the wrapper can send to the game: