PlayerSessionService
plany.session.v1.PlayerSessionService — who is playing on your servers, and who was.
Plany works out who is playing from your game server's own output and from the connections players make to it, with nothing to integrate. This service answers these questions:
| Question | Call |
|---|---|
| Who is on this server right now? | GetPresence on .../gameServers/{game_server}/presence |
| Which of my servers have players? | ListPresence on projects/{project}/locations/{location}, with occupied_only: true |
| Who played, and for how long? | ListPlayerSessions on a game server, optionally for a time_range or one player_key |
| Where were connections from? | ListConnections on a game server |
PlayersPlayers and connections are different records
A player session is a named player joining and leaving, as the server itself
reported it. A connection is a socket — an address, a port, a time — with no
player attached. Presence counts both, and connection_count is usually the
larger: a game client can open more than one socket, and several players in one
household share an address.
waiting_connection_count is the number to watch while a server starts:
somebody has connected and nobody has joined yet.
Session ends
A session usually ends because the server reported the player leaving. When nothing reported it — the server stopped, or the record aged out — the end reason says so.
END_REASON_EXPIRED means nobody reported the departure and the session aged
out. Its length is an upper bound, not a measurement; cap it rather than
trusting it if you are computing playtime.
CLOSE_REASON_WAKE_TIMEOUT on a connection means a player waited for a stopped
server to start and it did not start in time.
Permissions
| Permission | Lets you | Held by |
|---|---|---|
session.presence.get | Read presence. | Viewers and above |
session.playerSessions.list | Read sessions. | Viewers and above |
session.connections.list | Read connections, including players' addresses. | Project editors and owners, account administrators and owners — not viewers |