Appearance
Websockets
Some games need a live, two-way connection between the game and the site. A multiplayer game, a jackpot ticker, and a real-time promotion are examples. The site serves this connection with the websocket router. The websocket router is a service that runs on every hizi site.
You turn this connection on or off for each game separately. The setting lives in the hizi app, on the game itself. There is no global switch, and there is no switch per Identity.
Turn websockets on or off
- Go to app.hizi.io.
- Open App > Games.
- Open the game you want to change. To set the value on a new game, click "Add" instead.
- Open the "Game settings" tab. The tab is next to "Details".
- Set the "Enable websockets" switch. The switch sits below "Game engine base URL".
- Save the game.
- Open App > Publish and publish. The switch only reaches the operator sites when you publish.
The switch is off by default. A new game has no websocket connection until you turn the switch on.
What each position does
On. The site accepts a websocket connection for this game. It accepts game messages on that connection. It accepts a broadcast from the game.
Off. The site refuses all three. It answers with an "invalid parameter" error and logs that the game is not enabled for websockets. The player's game still runs. Only the live connection is gone.
The setting is per game and per tenant. It applies to every Identity that has access to the game. To keep websockets off for one operator only, remove the game's permission for that Identity instead.
Websocket password
The "Websocket password" field sits next to the switch. It holds the shared secret that authenticates the game against the site's websocket router.
Set a password. If you leave the field empty, the site accepts a broadcast for this game without a check on the sender.
Enter the SHA-1 digest, not the plain secret
The site compares the value in this field with the SHA-1 hex digest of the secret that the game sends. It does not hash the field for you. Enter the SHA-1 hex digest of the shared secret. The game keeps the plain secret and sends it in its authentication header.
Compute the digest like this:
bash
printf '%s' 'your-shared-secret' | sha1sumA change to the password also needs a publish before the site uses it.
Check the setting
The websocket router logs every refusal. Open App > Logs. Search for websocket-router, and select the site the Identity runs on. A message that reads "not enabled for websockets" means the switch is still off on that site. The most common cause is a change that nobody published yet.