Login & Session #
After connecting to a gateway with a Pragma token, the engine establishes a user session, such as Player or Operator.
The recommended configuration is to maintain a long-lived WebSocket. This enables bidirectional communication and platform notifications that can be sent to clients without polling patterns. This improves scalability and enables rich features such as party update broadcasts while minimizing network traffic.
Clients can also send messages through HTTP, which is useful for testing and web portal functionality. While fully featured, the HTTP flow is not designed for high-load production scenarios.
LoginDataPlugin collects data from multiple sources and sends it to the client on player login. It
defines dependent jobs that should be executed whenever a player logs in, and by default
collects a player’s inventory data. Authoring additional dependent jobs can handle new capabilities, such as granting players rewards on
Player login using existing sessions #
Pragma Engine provides a way to customize the length of time a player’s session token is valid, and then use that token for future logins within the established timeframe.
These are the default values in the YAML config for the
TokenSignerConfig, which includes the configurable
social: serviceConfigs: TokenSignerConfig: jwtPrivateKey: "<RSA Private key>" partnerExpirationHours: 876000 operatorExpirationMinutes: 2880 emailTokenExpirationMinutes: 10080 playerTokenExpirationMinutes: 1440 playerTokenRefreshMinutes: 45 playerTokenRefreshVarianceWindowMinutes: 5
Once you’ve configured the length of time a token is valid, you can manually store tokens on a user’s machine. The SDKs support logging in
with existing authentication tokens via an overload of
LogIn on the
Player session class.
Player - Game clients connect to the Player gateway. This is facilitated by the Pragma SDK embedded in your game project.
Partner - This is a trusted endpoint that enables server-to-server communication for partner services such as dedicated game servers.
Operator - This is a trusted endpoint protected by VPN. This powers APIs for the web portal and other admin capabilities.
Login Queue #
The login queue feature routes your players through a queue when they attempt to log in using your authentication services. With the login queue feature you get the following benefits:
- You can rate limit logins to help manage larger than normal number of requests to your game, such as on launch days.
- You can use authentication servers with lower hardware requirements without the risk of server overload.
- You can provide more information to your players on the login screen.
Understanding the login queue configuration #
The login queue feature is enabled by default in the
LoginQueueServiceConfig, and set with some initial values to get you started. These
initial values are great place to start before tuning your login queue.
game: serviceConfigs: LoginQueueServiceConfig: enabled: true targetLoginRatePerSecond: 50 targetCcuLimit: 10000 estimatedSecondsToLogin: 10
Review the following table to understand how to tune these values:
|The target number of users to log in per second.||Set this value lower than the maximum number of requests your authentication server can handle per second.|
|The target maximum number of concurrent users logged in.||Set this to a value lower than your game servers maximum concurrent players that does not overload your game servers.|
|The time between a user login request and the user gaining access.||Set this to the average amount of time it takes your system to log in a user.|
Get started with login queues #
- Verify that you’re using the latest version of Pragma Engine.
- Review the default values set in the
LoginQueueServiceConfigand ensure they match your environment’s needs.
- [Optional] Set up your game client to listen for the
QueueUpdateDatastructure contains the following details that your game client can use to provide your users more details about their log in experience.
Eta: The estimated amount of time until the user is logged in.
PositionInQueue: The users place in the login queue.
The login queue functionality is built into the Pragma SDK for Unreal and Unity. The following examples can be found in the Pragma SDK test examples for Unreal and Unity.