Photon servers can broadcast application and lobby statistics to clients. You can make use of this data to implement a complex custom matchmaking system. You can also brag about these statistics in your game to show how popular it is. :]
When connected to a Photon master server, a Photon client receives applications statistics. Regardless of whether the client is joined to a lobby or not, it will receive AppStats events. Application statistics are per region.
The applications statistics are:
- Number of live rooms:
- Number of players not joined to rooms:
- Number of players inside rooms:
- Total number of connected players:
AppStats event is sent to client every five seconds.
In the native C++ SDK, the
Listener class provides a callback every time to know that the statistics' getters are updated:
Lobby statistics can be useful if a game uses multiple lobbies and you want to show the activity. Lobby statistics are per region.
Per typed lobby (name + type) you can get information about:
- Number of live rooms
- Number of players not joined to a room
Automatically Get Lobby Statistics
Lobby statistics events are sent as soon as the client is authenticated to a master server. Then they are sent every minute. Lobby statistics events are disabled by default.
Before connecting, to enable lobby statistics:
Lobby statistics are updated and cached, you can get them using:
To enable lobby statistics, one has to pass true for parameter
autoLobbyStats to the constructor of class
Listener class provides the following optional callback whenever a lobby stats event arrives (when enabled):
Explicitly Get Lobby Statistics
You can explicitly request lobby statistics using an operation call when not joined to a room:
This is currently not implemented.
Listener class provides the following optional callback when the response arrives: