Proxy Module & Handshake
The Proxy Module is the client's physical entry point into PlayServ. It handles the handshake flow, validates the connection prerequisites, applies connection policy, and only then allows the client to become logically ready for server-side gameplay logic.
The handshake provides a single controlled point where PlayServ can validate identity and session constraints before the client is considered ready. This is where connection policy decisions are enforced.
Use this flow whenever a client needs to establish a session with PlayServ and reach a state where gameplay systems can safely start working — RPC calls, events, groups, and data subscriptions.
Handshake flow
Authorisation and basic validation
During the handshake, Proxy performs authorisation:
- validates client tokens
- validates
GameId
If validation fails, the connection is rejected.
Connection policy: multiple connections per device
If Proxy detects multiple active connections for the same UserDeviceToken, it invokes the TooManyConnections RPC method, if it is declared in the server code.
The method receives:
Current— the new sessionAll— all sessions, including the new one
The method returns the list of sessions that should remain active.
[Server]
public class ClientConnection
{
// Connection policy validation
public Session[] TooManyConnections(Session Current, Session[] All)
{
// Current - new session
// All - all sessions including the new one
return All; // keep all sessions, allow the new connection
return [Current]; // close all sessions except the new one
return []; // close all sessions for the user
}
}
Connection policy is enforced before the client is considered ready. Treat TooManyConnections as the gate that decides whether the new connection can coexist with previous ones.
Register the connection
If all checks pass, Proxy registers the client connection by GameId.
Logical connection and ClientReady
After the client is logically connected to the Game Server — the game code running in the RPC Module — the ClientReady event is emitted.
This is the point where the Game Server can make the final decision whether the client is allowed to participate in the game.
Next step
The handshake outcomes map directly into session states and the recovery flow. Continue with Session Lifecycle & States.
For related topics:
- Session Lifecycle & States — how handshake outcomes map into session states
- User Login & Authentication — how authentication impacts the handshake path
- RPC & Server-side Game Logic — where the game server code that reacts to
ClientReadylives