Version: en

Multiplay Session Service

warning

This documentatin is now deprecated. If you are using Matchmaker Self Serve though UDash contact us directly to get access to the new documentation

The Multiplay session service acts as a key-value store that can store temporary information about a given game session between the matchmaker and gameserver.

Game setup#

When your game is integrated by Multiplay, a field is created in your configuration file that contains the session auth. In addition, the session_auth associated setting on the profile is set to bearer <my_jwt_here>.

note

Multiplay standard AWS4 authorization is required for the following JWT creation and profile update endpoints.

A full example of the JWT creation process is included in the following Postman collection example. In this collection, to create a token, you need to make an AWS4 authed request to the JWT issuer. In addition, for the matchmaker beta, it is recommended that you use a very long time for the expiry (this example uses an expiration of 10 years).

GET to https://api.multiplay.co.uk/cfp/v3/jwtissuer/projects/{{unity_projectid}}/jwts?exp=1893456000

A full example of the update profile endpoint is included in the following Postman collection example. In this collection, you need to make an AWS4 authed request to the profile update endpoint with a new JWT.

PATCH to https://api.multiplay.co.uk/v3/profiles/{{profileid}}
JSON BODY:
{
"settings": {
"session_auth": "bearer <token_here>",
}
}

The recommended process for consuming the JWT on the game server is to read it from the server.json file that is passed in on the recommended command line startup arguments. The Unity sample provides an implementation of this process. The steps for enabling the server.json are documented in the Multiplay Integration onboarding document.

Session storage and retrieval#

Calls to the session store GRPC and HTTPS endpoints should contain the following JWT authentication.

HTTP using request headers:

Authorization: <session_auth read from config>
GRPC using Metadata: (For example in Go)
ctx := metadata.AppendToOutgoingContext(r, "Authorization", "<session_auth read from config>")

You can set information about a session by using the GRPC set endpoint. This stores a byte array that contains arbitrary data under a specific session ID.

note

Session data has an hour lifetime, and is removed one hour after it is set. Any subsequent sets extend the lifetime by another hour.

You can retrieve information about a session by using the GRPC get and HTTPS get endpoints that are described in the Postman and the session.proto files. These files require that you supply the session ID, and they return a byte array that contains session information.

Postman collection#

The following Postman collection contains examples of the HTTP endpoints:

Protobuf support#

Use the following proto file to generate clients to interact with the GRPC endpoints: