Skip to main content

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.

info

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

1

Authorisation and basic validation

During the handshake, Proxy performs authorisation:

  • validates client tokens
  • validates GameId

If validation fails, the connection is rejected.

2

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 session
  • All — 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
}
}
warning

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.

3

Register the connection

If all checks pass, Proxy registers the client connection by GameId.

4

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: