Skip to content

Game Launch

When you create a game definition in the back office, you must define the location of a frontend index document.

When a game launch request occurs, the system redirects the player's web browser to the given URL. The system also passes a temporary (short-life) token as a parameter. It also passes a URL together with the token. The game uses this URL to connect to the back office. The game uses the URL to check that the token is correct.

A typical URL looks like this

https://test.gamestudio/index.html?token=3869af18-7e8b-415f-b9d7-dd8f2fb61162&login=http%3A%2F%2Fgamestudio%3A4577%2Fgameapi%2Fv2%2Fconnect
Parameter (GET)
tokenUse this short-life token in the login call.
loginUse this URL to connect to the hizi.io RGS. The RGS returns a long-life token in response.

The frontend now calls the URL passed in the login parameter. It passes the short-life token as a parameter of this GET request.

This call returns basic game information and token data. The token data contains a new token ID. This ID is now a long-life token. Use this long-life token for all further calls. The response also includes endpoints for calls to the game engine. The call returns all data as a JSON object.

The short-life token works only once. If the call fails, the operator must request a new game launch URL.

The login call returns this data. The game frontend must use the fields in bold.

tokenLong-life token ID. Use this token for every subsequent call to backendUrl or refreshUrl.
backendUrlLocation of the game engine endpoint
webSocketUrlOptional URL for a websocket connection. Use this connection as an alternative to POST requests to backendUrl. For more information, request sample code from hizi.io customer support.
logoutUrlOptional URL to log out of the game. Calling this URL invalidates the long-life token. The operator must then send a new game launch request.
refreshUrlOptional URL to reconnect to a session. This call is equivalent to the login URL passed in the launch command. It needs a long-life token instead of a short-life token.
balanceContains information about the player's balance
gameSettingsThe game uses these gameSettings.
operatorProtocolDefines the operator protocol in use. This is an informational parameter. It lets the game support operator-specific requirements. For more information, request sample code from hizi.io customer support.
tokenDataContents of the long-life token. This includes playerid, operatorid, gameid, gamemode (REAL or DEMO), and currency information.

NOTE: This call sends information about a potential open game round in tokenData. This information allows the game to resume.