Photon .NET Client API 4.1.4.8

Classes | Public Member Functions | Public Attributes | Properties | List of all members
Photon.Realtime.SupportLogger Class Reference

Helper class to debug log basic information about Photon client and vital traffic statistics. More...

Inheritance diagram for Photon.Realtime.SupportLogger:
Photon.Realtime.IConnectionCallbacks Photon.Realtime.IInRoomCallbacks Photon.Realtime.IMatchmakingCallbacks Photon.Realtime.ILobbyCallbacks

Public Member Functions

void StartLogStats ()
 
void StopLogStats ()
 
void LogStats ()
 Debug logs vital traffic statistics about the attached Photon Client. More...
 
void OnConnected ()
 Called to signal that the "low level connection" got established but before the client can call operation on the server. More...
 
void OnConnectedToMaster ()
 Called when the client is connected to the Master Server and ready for matchmaking and other tasks. More...
 
void OnFriendListUpdate (List< FriendInfo > friendList)
 Called when the server sent the response to a FindFriends request. More...
 
void OnJoinedLobby ()
 Called on entering a lobby on the Master Server. The actual room-list updates will call OnRoomListUpdate. More...
 
void OnLeftLobby ()
 Called after leaving a lobby. More...
 
void OnCreateRoomFailed (short returnCode, string message)
 Called when the server couldn't create a room (OpCreateRoom failed). More...
 
void OnJoinedRoom ()
 Called when the LoadBalancingClient entered a room, no matter if this client created it or simply joined. More...
 
void OnJoinRoomFailed (short returnCode, string message)
 Called when a previous OpJoinRoom call failed on the server. More...
 
void OnJoinRandomFailed (short returnCode, string message)
 Called when a previous OpJoinRandom call failed on the server. More...
 
void OnCreatedRoom ()
 Called when this client created a room and entered it. OnJoinedRoom() will be called as well. More...
 
void OnLeftRoom ()
 Called when the local user/client left a room, so the game's logic can clean up it's internal state. More...
 
void OnDisconnected (DisconnectCause cause)
 Called after disconnecting from the Photon server. It could be a failure or an explicit disconnect call More...
 
void OnRegionListReceived (RegionHandler regionHandler)
 Called when the Name Server provided a list of regions for your title. More...
 
void OnRoomListUpdate (List< RoomInfo > roomList)
 Called for any update of the room-listing while in a lobby (InLobby) on the Master Server. More...
 
void OnPlayerEnteredRoom (Player newPlayer)
 Called when a remote player entered the room. This Player is already added to the playerlist. More...
 
void OnPlayerLeftRoom (Player otherPlayer)
 Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive. More...
 
void OnRoomPropertiesUpdate (Hashtable propertiesThatChanged)
 Called when a room's custom properties changed. The propertiesThatChanged contains all that was set via Room.SetCustomProperties. More...
 
void OnPlayerPropertiesUpdate (Player targetPlayer, Hashtable changedProps)
 Called when custom player-properties are changed. Player and the changed properties are passed as object[]. More...
 
void OnMasterClientSwitched (Player newMasterClient)
 Called after switching to a new MasterClient when the current one leaves. More...
 
void OnCustomAuthenticationResponse (Dictionary< string, object > data)
 Called when your Custom Authentication service responds with additional data. More...
 
void OnCustomAuthenticationFailed (string debugMessage)
 Called when the custom authentication failed. Followed by disconnect! More...
 
void OnLobbyStatisticsUpdate (List< TypedLobbyInfo > lobbyStatistics)
 Called when the Master Server sent an update for the Lobby Statistics. More...
 
void OnErrorInfo (ErrorInfo errorInfo)
 

Public Attributes

bool LogTrafficStats = true
 Toggle to enable or disable traffic statistics logging. More...
 

Properties

LoadBalancingClient Client [get, set]
 Photon client to log information and statistics from. More...
 

Detailed Description

Helper class to debug log basic information about Photon client and vital traffic statistics.

Set SupportLogger.Client for this to work.

Member Function Documentation

◆ LogStats()

void Photon.Realtime.SupportLogger.LogStats ( )
inline

Debug logs vital traffic statistics about the attached Photon Client.

◆ OnConnected()

void Photon.Realtime.SupportLogger.OnConnected ( )
inline

Called to signal that the "low level connection" got established but before the client can call operation on the server.

After the (low level transport) connection is established, the client will automatically send the Authentication operation, which needs to get a response before the client can call other operations.

Your logic should wait for either: OnRegionListReceived or OnConnectedToMaster.

This callback is useful to detect if the server can be reached at all (technically). Most often, it's enough to implement OnDisconnected(DisconnectCause cause) and check for the cause.

This is not called for transitions from the masterserver to game servers.

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnConnectedToMaster()

void Photon.Realtime.SupportLogger.OnConnectedToMaster ( )
inline

Called when the client is connected to the Master Server and ready for matchmaking and other tasks.

The list of available rooms won't become available unless you join a lobby via LoadBalancingClient.OpJoinLobby. You can join rooms and create them even without being in a lobby. The default lobby is used in that case.

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnCreatedRoom()

void Photon.Realtime.SupportLogger.OnCreatedRoom ( )
inline

Called when this client created a room and entered it. OnJoinedRoom() will be called as well.

This callback is only called on the client which created a room (see OpCreateRoom).

As any client might close (or drop connection) anytime, there is a chance that the creator of a room does not execute OnCreatedRoom.

If you need specific room properties or a "start signal", implement OnMasterClientSwitched() and make each new MasterClient check the room's state.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnCreateRoomFailed()

void Photon.Realtime.SupportLogger.OnCreateRoomFailed ( short  returnCode,
string  message 
)
inline

Called when the server couldn't create a room (OpCreateRoom failed).

Creating a room may fail for various reasons. Most often, the room already exists (roomname in use) or the RoomOptions clash and it's impossible to create the room.

When creating a room fails on a Game Server: The client will cache the failure internally and returns to the Master Server before it calls the fail-callback. This way, the client is ready to find/create a room at the moment of the callback. In this case, the client skips calling OnConnectedToMaster but returning to the Master Server will still call OnConnected. Treat callbacks of OnConnected as pure information that the client could connect.

Parameters
returnCodeOperation ReturnCode from the server.
messageDebug message for the error.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnCustomAuthenticationFailed()

void Photon.Realtime.SupportLogger.OnCustomAuthenticationFailed ( string  debugMessage)
inline

Called when the custom authentication failed. Followed by disconnect!

Custom Authentication can fail due to user-input, bad tokens/secrets. If authentication is successful, this method is not called. Implement OnJoinedLobby() or OnConnectedToMaster() (as usual).

During development of a game, it might also fail due to wrong configuration on the server side. In those cases, logging the debugMessage is very important.

Unless you setup a custom authentication service for your app (in the Dashboard), this won't be called!

Parameters
debugMessageContains a debug message why authentication failed. This has to be fixed during development.

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnCustomAuthenticationResponse()

void Photon.Realtime.SupportLogger.OnCustomAuthenticationResponse ( Dictionary< string, object >  data)
inline

Called when your Custom Authentication service responds with additional data.

Custom Authentication services can include some custom data in their response. When present, that data is made available in this callback as Dictionary. While the keys of your data have to be strings, the values can be either string or a number (in Json). You need to make extra sure, that the value type is the one you expect. Numbers become (currently) int64.

Example: void OnCustomAuthenticationResponse(Dictionary<string, object> data) { ... }

https://doc.photonengine.com/en-us/realtime/current/reference/custom-authentication

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnDisconnected()

void Photon.Realtime.SupportLogger.OnDisconnected ( DisconnectCause  cause)
inline

Called after disconnecting from the Photon server. It could be a failure or an explicit disconnect call

The reason for this disconnect is provided as DisconnectCause.

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnErrorInfo()

void Photon.Realtime.SupportLogger.OnErrorInfo ( ErrorInfo  errorInfo)
inline

◆ OnFriendListUpdate()

void Photon.Realtime.SupportLogger.OnFriendListUpdate ( List< FriendInfo friendList)
inline

Called when the server sent the response to a FindFriends request.

After calling OpFindFriends, the Master Server will cache the friend list and send updates to the friend list. The friends includes the name, userId, online state and the room (if any) for each requested user/friend.

Use the friendList to update your UI and store it, if the UI should highlight changes.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnJoinedLobby()

void Photon.Realtime.SupportLogger.OnJoinedLobby ( )
inline

Called on entering a lobby on the Master Server. The actual room-list updates will call OnRoomListUpdate.

While in the lobby, the roomlist is automatically updated in fixed intervals (which you can't modify in the public cloud). The room list gets available via OnRoomListUpdate.

Implements Photon.Realtime.ILobbyCallbacks.

◆ OnJoinedRoom()

void Photon.Realtime.SupportLogger.OnJoinedRoom ( )
inline

Called when the LoadBalancingClient entered a room, no matter if this client created it or simply joined.

When this is called, you can access the existing players in Room.Players, their custom properties and Room.CustomProperties.

In this callback, you could create player objects. For example in Unity, instantiate a prefab for the player.

If you want a match to be started "actively", enable the user to signal "ready" (using OpRaiseEvent or a Custom Property).

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnJoinRandomFailed()

void Photon.Realtime.SupportLogger.OnJoinRandomFailed ( short  returnCode,
string  message 
)
inline

Called when a previous OpJoinRandom call failed on the server.

The most common causes are that a room is full or does not exist (due to someone else being faster or closing the room).

This operation is only ever sent to the Master Server. Once a room is found by the Master Server, the client will head off to the designated Game Server and use the operation Join on the Game Server.

When using multiple lobbies (via OpJoinLobby or a TypedLobby parameter), another lobby might have more/fitting rooms.

Parameters
returnCodeOperation ReturnCode from the server.
messageDebug message for the error.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnJoinRoomFailed()

void Photon.Realtime.SupportLogger.OnJoinRoomFailed ( short  returnCode,
string  message 
)
inline

Called when a previous OpJoinRoom call failed on the server.

Joining a room may fail for various reasons. Most often, the room is full or does not exist anymore (due to someone else being faster or closing the room).

When joining a room fails on a Game Server: The client will cache the failure internally and returns to the Master Server before it calls the fail-callback. This way, the client is ready to find/create a room at the moment of the callback. In this case, the client skips calling OnConnectedToMaster but returning to the Master Server will still call OnConnected. Treat callbacks of OnConnected as pure information that the client could connect.

Parameters
returnCodeOperation ReturnCode from the server.
messageDebug message for the error.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnLeftLobby()

void Photon.Realtime.SupportLogger.OnLeftLobby ( )
inline

Called after leaving a lobby.

When you leave a lobby, OpCreateRoom and OpJoinRandomRoom automatically refer to the default lobby.

Implements Photon.Realtime.ILobbyCallbacks.

◆ OnLeftRoom()

void Photon.Realtime.SupportLogger.OnLeftRoom ( )
inline

Called when the local user/client left a room, so the game's logic can clean up it's internal state.

When leaving a room, the LoadBalancingClient will disconnect the Game Server and connect to the Master Server. This wraps up multiple internal actions.

Wait for the callback OnConnectedToMaster, before you use lobbies and join or create rooms.

Implements Photon.Realtime.IMatchmakingCallbacks.

◆ OnLobbyStatisticsUpdate()

void Photon.Realtime.SupportLogger.OnLobbyStatisticsUpdate ( List< TypedLobbyInfo lobbyStatistics)
inline

Called when the Master Server sent an update for the Lobby Statistics.

This callback has two preconditions: EnableLobbyStatistics must be set to true, before this client connects. And the client has to be connected to the Master Server, which is providing the info about lobbies.

Implements Photon.Realtime.ILobbyCallbacks.

◆ OnMasterClientSwitched()

void Photon.Realtime.SupportLogger.OnMasterClientSwitched ( Player  newMasterClient)
inline

Called after switching to a new MasterClient when the current one leaves.

This is not called when this client enters a room. The former MasterClient is still in the player list when this method get called.

Implements Photon.Realtime.IInRoomCallbacks.

◆ OnPlayerEnteredRoom()

void Photon.Realtime.SupportLogger.OnPlayerEnteredRoom ( Player  newPlayer)
inline

Called when a remote player entered the room. This Player is already added to the playerlist.

If your game starts with a certain number of players, this callback can be useful to check the Room.playerCount and find out if you can start.

Implements Photon.Realtime.IInRoomCallbacks.

◆ OnPlayerLeftRoom()

void Photon.Realtime.SupportLogger.OnPlayerLeftRoom ( Player  otherPlayer)
inline

Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive.

If another player leaves the room or if the server detects a lost connection, this callback will be used to notify your game logic.

Depending on the room's setup, players may become inactive, which means they may return and retake their spot in the room. In such cases, the Player stays in the Room.Players dictionary.

If the player is not just inactive, it gets removed from the Room.Players dictionary, before the callback is called.

Implements Photon.Realtime.IInRoomCallbacks.

◆ OnPlayerPropertiesUpdate()

void Photon.Realtime.SupportLogger.OnPlayerPropertiesUpdate ( Player  targetPlayer,
Hashtable  changedProps 
)
inline

Called when custom player-properties are changed. Player and the changed properties are passed as object[].

Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too.

Parameters
targetPlayerContains Player that changed.
changedPropsContains the properties that changed.

Implements Photon.Realtime.IInRoomCallbacks.

◆ OnRegionListReceived()

void Photon.Realtime.SupportLogger.OnRegionListReceived ( RegionHandler  regionHandler)
inline

Called when the Name Server provided a list of regions for your title.

Check the RegionHandler class description, to make use of the provided values.

Parameters
regionHandlerThe currently used RegionHandler.

Implements Photon.Realtime.IConnectionCallbacks.

◆ OnRoomListUpdate()

void Photon.Realtime.SupportLogger.OnRoomListUpdate ( List< RoomInfo roomList)
inline

Called for any update of the room-listing while in a lobby (InLobby) on the Master Server.

Each item is a RoomInfo which might include custom properties (provided you defined those as lobby-listed when creating a room). Not all types of lobbies provide a listing of rooms to the client. Some are silent and specialized for server-side matchmaking.

Implements Photon.Realtime.ILobbyCallbacks.

◆ OnRoomPropertiesUpdate()

void Photon.Realtime.SupportLogger.OnRoomPropertiesUpdate ( Hashtable  propertiesThatChanged)
inline

Called when a room's custom properties changed. The propertiesThatChanged contains all that was set via Room.SetCustomProperties.

Since v1.25 this method has one parameter: Hashtable propertiesThatChanged.
Changing properties must be done by Room.SetCustomProperties, which causes this callback locally, too.

Parameters
propertiesThatChanged

Implements Photon.Realtime.IInRoomCallbacks.

◆ StartLogStats()

void Photon.Realtime.SupportLogger.StartLogStats ( )
inline

◆ StopLogStats()

void Photon.Realtime.SupportLogger.StopLogStats ( )
inline

Member Data Documentation

◆ LogTrafficStats

bool Photon.Realtime.SupportLogger.LogTrafficStats = true

Toggle to enable or disable traffic statistics logging.

Property Documentation

◆ Client

LoadBalancingClient Photon.Realtime.SupportLogger.Client
getset

Photon client to log information and statistics from.


The documentation for this class was generated from the following file: