Communication Protocol

In order to respond to VXG requests, Games and Providers have to be connected to the VXG servers at all time via WebSocket. They use the same JSON-based protocol, which is described in this section.
You can have as many concurrent connections as you want. We recommend having at least 2 active connections at a time. Every request will be sent using only one of the active connections. You must respond using the connection which was used to send the request.

Starting the connection

The WebSocket endpoint for both Games and Providers is the same: wss:// You must provide two parameters in the query string:
  • api-key: API key obtained from the Developer Dashboard,
  • type: game or provider
If your server does not send any messages for 15 seconds, the connection will be closed immediately. In order to prevent this, you must send ping frames, as described in the latest official WebSocket specification. We recommend sending them every 5 seconds. VXG will respond with a pong frame to every ping frame.

Handling errors

If your server does not send any messages for 15 seconds or any communication error occurs, VXG will send a JSON-encoded message with the error and close the connection immediately. The message will contain a single value error of type String, which will describe the error.
If the connection is closed for any reason, you should try to reconnect in 3 seconds.

Handling requests

VXG will send JSON-encoded requests with two values:
  • id (String): The ID of this request. When responding to the request, you must send the same ID.
  • data (Object): Information about this request. You must process it and send a response as soon as possible.
You must respond to each request within 5 seconds. If you fail to do that, the connection will be closed immediately.

Sending responses

The responses use the same JSON-based format as the requests. They have the id value, which is the ID of the requests, and data value, which is an Object containing the response data.