This document describes how Stormancer clients connect to scenes.
Obtaining a scene connection token
Connection tokens are signed base64 encoded strings that secure the connection of a client to a given scene. Such a token must be obtained beforehand by a client that is willing to connect to the scene.
If the target scene is public, the client can issue a call to the Get token web API. Any content in the request body will be appended to the token and signed, along with the content type. A server application will be able to access this data associated with the connection. Use this feature to send json or msgpack serialized user profile data for instance.
In the client libraries, this operation is performed by the
client.GetPublicScene(string sceneId, object userData) method. User data is msgpack serialized.
- Extract the network endpoints from the connection token
- Select an endpoint suitable for the best available transport (Raknet or websocket)
- Connect to the endpoint
- Update the connection metadata by sending an
- Perform an
ID_GET_SCENE_INFOSsystem request using the token to retrieve informations about the target scene.
- Set the serializer proposed by the system request response as default serializer, add the
serializermetadata value then update the connection metadata.
- Register local route handlers.
- Send a
ID_CONNECT_TO_SCENEsystem request that contains the local route handlers.
- Use the information returned by the request to complete initialization of the scene object (set scene handle and local route handles)