Photon .NET Client API 4.1.4.8

Classes | Typedefs | Enumerations
Photon.Realtime Namespace Reference

Classes

class  ActorProperties
 Class for constants. These (byte) values define "well known" properties for an Actor / Player. More...
 
class  AppSettings
 Settings for Photon application(s) and the server to connect to. More...
 
class  AuthenticationValues
 Container for user authentication in Photon. Set AuthValues before you connect - all else is handled. More...
 
class  ConnectionCallbacksContainer
 Container type for callbacks defined by IConnectionCallbacks. See LoadBalancingCallbackTargets. More...
 
class  ConnectionHandler
 
class  EncryptionDataParameters
 
class  EnterRoomParams
 Parameters for creating rooms. More...
 
class  ErrorCode
 ErrorCode defines the default codes associated with Photon client/server communication. More...
 
class  ErrorInfo
 Class wrapping the received EventCode.ErrorInfo event. More...
 
class  ErrorInfoCallbacksContainer
 Container type for callbacks defined by IErrorInfoCallback. See LoadBalancingClient.ErrorInfoCallbackTargets.
 
class  EventCode
 Class for constants. These values are for events defined by Photon LoadBalancing. More...
 
class  Extensions
 This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).
 
class  FindFriendsOptions
 Options for OpFindFriends can be combined to filter which rooms of friends are returned. More...
 
class  FriendInfo
 Used to store info about a friend's online state and in which room he/she is. More...
 
class  GamePropertyKey
 Class for constants. These (byte) values are for "well known" room/game properties used in Photon LoadBalancing. More...
 
interface  IConnectionCallbacks
 Collection of "organizational" callbacks for the Realtime Api to cover: Connection and Regions. More...
 
interface  IErrorInfoCallback
 Interface for EventCode.ErrorInfo event callback for the Realtime Api. More...
 
interface  IInRoomCallbacks
 Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching. More...
 
interface  ILobbyCallbacks
 Collection of "organizational" callbacks for the Realtime Api to cover the Lobby. More...
 
interface  IMatchmakingCallbacks
 Collection of "organizational" callbacks for the Realtime Api to cover Matchmaking. More...
 
class  InRoomCallbacksContainer
 Container type for callbacks defined by IInRoomCallbacks. See InRoomCallbackTargets.
 
interface  IOnEventCallback
 Event callback for the Realtime Api. Covers events from the server and those sent by clients via OpRaiseEvent. More...
 
interface  IWebRpcCallback
 Interface for "WebRpc" callbacks for the Realtime Api. Currently includes only responses for Web RPCs. More...
 
class  LoadBalancingClient
 This class implements the Photon LoadBalancing workflow by using a LoadBalancingPeer. It keeps a state and will automatically execute transitions between the Master and Game Servers. More...
 
class  LoadBalancingPeer
 A LoadBalancingPeer provides the operations and enum definitions needed to use the LoadBalancing server application which is also used in Photon Cloud. More...
 
class  LobbyCallbacksContainer
 Container type for callbacks defined by ILobbyCallbacks. See LobbyCallbackTargets.
 
class  MatchMakingCallbacksContainer
 Container type for callbacks defined by IMatchmakingCallbacks. See MatchMakingCallbackTargets. More...
 
class  OperationCode
 Class for constants. Contains operation codes. More...
 
class  OpJoinRandomRoomParams
 Parameters for the matchmaking of JoinRandomRoom and JoinRandomOrCreateRoom. More...
 
class  ParameterCode
 Class for constants. Codes for parameters of Operations and Events. More...
 
class  PhotonPing
 Abstract implementation of PhotonPing, ase for pinging servers to find the "Best Region". More...
 
struct  PhotonPortDefinition
 Container for port definitions. More...
 
class  PingMono
 Uses C# Socket class from System.Net.Sockets (as Unity usually does). More...
 
class  Player
 Summarizes a "player" within a room, identified (in that room) by ID (or "actorNumber"). More...
 
class  RaiseEventOptions
 Aggregates several less-often used options for operation RaiseEvent. See field descriptions for usage details. More...
 
class  Region
 
class  RegionHandler
 Provides methods to work with Photon's regions (Photon Cloud) and can be use to find the one with best ping. More...
 
class  RegionPinger
 
class  Room
 This class represents a room a client joins/joined. More...
 
class  RoomInfo
 A simplified room with just the info required to list and join, used for the room listing in the lobby. The properties are not settable (IsOpen, MaxPlayers, etc). More...
 
class  RoomOptions
 Wraps up common room properties needed when you create rooms. Read the individual entries for more details. More...
 
class  SupportLogger
 Helper class to debug log basic information about Photon client and vital traffic statistics. More...
 
class  TypedLobby
 Refers to a specific lobby on the server. More...
 
class  TypedLobbyInfo
 Info for a lobby on the server. Used when LoadBalancingClient.EnableLobbyStatistics is true. More...
 
class  WebFlags
 Optional flags to be used in Photon client SDKs with Op RaiseEvent and Op SetProperties. Introduced mainly for webhooks 1.2 to control behavior of forwarded HTTP requests. More...
 
class  WebRpcCallbacksContainer
 Container type for callbacks defined by IWebRpcCallback. See WebRpcCallbackTargets.
 
class  WebRpcResponse
 Reads an operation response of a WebRpc and provides convenient access to most common values. More...
 

Typedefs

using SupportClass = ExitGames.Client.Photon.SupportClass
 
using Stopwatch = System.Diagnostics.Stopwatch
 

Enumerations

enum  ClientState {
  ClientState.PeerCreated, ClientState.Authenticating, ClientState.Authenticated, ClientState.JoiningLobby,
  ClientState.JoinedLobby, ClientState.DisconnectingFromMasterServer, ClientState.DisconnectingFromMasterserver = DisconnectingFromMasterServer, ClientState.ConnectingToGameServer,
  ClientState.ConnectingToGameserver = ConnectingToGameServer, ClientState.ConnectedToGameServer, ClientState.ConnectedToGameserver = ConnectedToGameServer, ClientState.Joining,
  ClientState.Joined, ClientState.Leaving, ClientState.DisconnectingFromGameServer, ClientState.DisconnectingFromGameserver = DisconnectingFromGameServer,
  ClientState.ConnectingToMasterServer, ClientState.ConnectingToMasterserver = ConnectingToMasterServer, ClientState.Disconnecting, ClientState.Disconnected,
  ClientState.ConnectedToMasterServer, ClientState.ConnectedToMasterserver = ConnectedToMasterServer, ClientState.ConnectedToMaster = ConnectedToMasterServer, ClientState.ConnectingToNameServer,
  ClientState.ConnectedToNameServer, ClientState.DisconnectingFromNameServer, ClientState.ConnectWithFallbackProtocol
}
 State values for a client, which handles switching Photon server types, some operations, etc. More...
 
enum  DisconnectCause {
  DisconnectCause.None, DisconnectCause.ExceptionOnConnect, DisconnectCause.Exception, DisconnectCause.ServerTimeout,
  DisconnectCause.ClientTimeout, DisconnectCause.DisconnectByServerLogic, DisconnectCause.DisconnectByServerReasonUnknown, DisconnectCause.InvalidAuthentication,
  DisconnectCause.CustomAuthenticationFailed, DisconnectCause.AuthenticationTicketExpired, DisconnectCause.MaxCcuReached, DisconnectCause.InvalidRegion,
  DisconnectCause.OperationNotAllowedInCurrentState, DisconnectCause.DisconnectByClientLogic, DisconnectCause.DisconnectByOperationLimit, DisconnectCause.DisconnectByDisconnectMessage
}
 Enumeration of causes for Disconnects (used in LoadBalancingClient.DisconnectedCause). More...
 
enum  ServerConnection { ServerConnection.MasterServer, ServerConnection.GameServer, ServerConnection.NameServer }
 Available server (types) for internally used field: server. More...
 
enum  EncryptionMode { EncryptionMode.PayloadEncryption, EncryptionMode.DatagramEncryption = 10, EncryptionMode.DatagramEncryptionRandomSequence = 11, EncryptionMode.DatagramEncryptionGCMRandomSequence = 12 }
 Defines how the communication gets encrypted. More...
 
enum  JoinMode : byte { JoinMode.Default = 0, JoinMode.CreateIfNotExists = 1, JoinMode.JoinOrRejoin = 2, JoinMode.RejoinOnly = 3 }
 Defines possible values for OpJoinRoom and OpJoinOrCreate. It tells the server if the room can be only be joined normally, created implicitly or found on a web-service for Turnbased games. More...
 
enum  MatchmakingMode : byte { MatchmakingMode.FillRoom = 0, MatchmakingMode.SerialMatching = 1, MatchmakingMode.RandomMatching = 2 }
 Options for matchmaking rules for OpJoinRandom. More...
 
enum  ReceiverGroup : byte { ReceiverGroup.Others = 0, ReceiverGroup.All = 1, ReceiverGroup.MasterClient = 2 }
 Lite - OpRaiseEvent lets you chose which actors in the room should receive events. By default, events are sent to "Others" but you can overrule this. More...
 
enum  EventCaching : byte {
  EventCaching.DoNotCache = 0, EventCaching.MergeCache = 1, EventCaching.ReplaceCache = 2, EventCaching.RemoveCache = 3,
  EventCaching.AddToRoomCache = 4, EventCaching.AddToRoomCacheGlobal = 5, EventCaching.RemoveFromRoomCache = 6, EventCaching.RemoveFromRoomCacheForActorsLeft = 7,
  EventCaching.SliceIncreaseIndex = 10, EventCaching.SliceSetIndex = 11, EventCaching.SlicePurgeIndex = 12, EventCaching.SlicePurgeUpToIndex = 13
}
 Lite - OpRaiseEvent allows you to cache events and automatically send them to joining players in a room. Events are cached per event code and player: Event 100 (example!) can be stored once per player. Cached events can be modified, replaced and removed. More...
 
enum  PropertyTypeFlag : byte { PropertyTypeFlag.None = 0x00, PropertyTypeFlag.Game = 0x01, PropertyTypeFlag.Actor = 0x02, PropertyTypeFlag.GameAndActor = Game | Actor }
 Flags for "types of properties", being used as filter in OpGetProperties. More...
 
enum  LobbyType : byte { LobbyType.Default = 0, LobbyType.SqlLobby = 2, LobbyType.AsyncRandomLobby = 3 }
 Types of lobbies define their behaviour and capabilities. Check each value for details. More...
 
enum  AuthModeOption { AuthModeOption.Auth, AuthModeOption.AuthOnce, AuthModeOption.AuthOnceWss }
 Options for authentication modes. From "classic" auth on each server to AuthOnce (on NameServer). More...
 
enum  CustomAuthenticationType : byte {
  CustomAuthenticationType.Custom = 0, CustomAuthenticationType.Steam = 1, CustomAuthenticationType.Facebook = 2, CustomAuthenticationType.Oculus = 3,
  CustomAuthenticationType.PlayStation = 4, CustomAuthenticationType.Xbox = 5, CustomAuthenticationType.Viveport = 10, CustomAuthenticationType.NintendoSwitch = 11,
  CustomAuthenticationType.None = byte.MaxValue
}
 Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon. More...
 

Typedef Documentation

◆ Stopwatch

using Photon.Realtime.Stopwatch = typedef System.Diagnostics.Stopwatch

◆ SupportClass

Enumeration Type Documentation

◆ AuthModeOption

Options for authentication modes. From "classic" auth on each server to AuthOnce (on NameServer).

Enumerator
Auth 
AuthOnce 
AuthOnceWss 

◆ ClientState

State values for a client, which handles switching Photon server types, some operations, etc.

Enumerator
PeerCreated 

Peer is created but not used yet.

Authenticating 

Transition state while connecting to a server. On the Photon Cloud this sends the AppId and AuthenticationValues (UserID).

Authenticated 

Not Used.

JoiningLobby 

The client sent an OpJoinLobby and if this was done on the Master Server, it will result in. Depending on the lobby, it gets room listings.

JoinedLobby 

The client is in a lobby, connected to the MasterServer. Depending on the lobby, it gets room listings.

DisconnectingFromMasterServer 

Transition from MasterServer to GameServer.

DisconnectingFromMasterserver 
ConnectingToGameServer 

Transition to GameServer (client authenticates and joins/creates a room).

ConnectingToGameserver 
ConnectedToGameServer 

Connected to GameServer (going to auth and join game).

ConnectedToGameserver 
Joining 

Transition state while joining or creating a room on GameServer.

Joined 

The client entered a room. The CurrentRoom and Players are known and you can now raise events.

Leaving 

Transition state when leaving a room.

DisconnectingFromGameServer 

Transition from GameServer to MasterServer (after leaving a room/game).

DisconnectingFromGameserver 
ConnectingToMasterServer 

Connecting to MasterServer (includes sending authentication values).

ConnectingToMasterserver 
Disconnecting 

The client disconnects (from any server). This leads to state Disconnected.

Disconnected 

The client is no longer connected (to any server). Connect to MasterServer to go on.

ConnectedToMasterServer 

Connected to MasterServer. You might use matchmaking or join a lobby now.

ConnectedToMasterserver 
ConnectedToMaster 
ConnectingToNameServer 

Client connects to the NameServer. This process includes low level connecting and setting up encryption. When done, state becomes ConnectedToNameServer.

ConnectedToNameServer 

Client is connected to the NameServer and established encryption already. You should call OpGetRegions or ConnectToRegionMaster.

DisconnectingFromNameServer 

Clients disconnects (specifically) from the NameServer (usually to connect to the MasterServer).

ConnectWithFallbackProtocol 

Client was unable to connect to Name Server and will attempt to connect with an alternative network protocol (TCP).

◆ CustomAuthenticationType

Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.

Enumerator
Custom 

Use a custom authentification service. Currently the only implemented option.

Steam 

Authenticates users by their Steam Account. Set auth values accordingly!

Facebook 

Authenticates users by their Facebook Account. Set auth values accordingly!

Oculus 

Authenticates users by their Oculus Account and token.

PlayStation 

Authenticates users by their PSN Account and token.

Xbox 

Authenticates users by their Xbox Account and XSTS token.

Viveport 

Authenticates users by their HTC Viveport Account and user token. Set AuthGetParameters to "userToken=[userToken]"

NintendoSwitch 

Authenticates users by their NSA ID.

None 

Disables custom authentification. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).

◆ DisconnectCause

Enumeration of causes for Disconnects (used in LoadBalancingClient.DisconnectedCause).

Read the individual descriptions to find out what to do about this type of disconnect.

Enumerator
None 

No error was tracked.

ExceptionOnConnect 

OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.

Exception 

OnStatusChanged: Some internal exception caused the socket code to fail. This may happen if you attempt to connect locally but the server is not available. In doubt: Contact Exit Games.

ServerTimeout 

OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgement from the client).

ClientTimeout 

OnStatusChanged: This client detected that the server's responses are not received in due time.

DisconnectByServerLogic 

OnStatusChanged: The server disconnected this client from within the room's logic (the C# code).

DisconnectByServerReasonUnknown 

OnStatusChanged: The server disconnected this client for unknown reasons.

InvalidAuthentication 

OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.

CustomAuthenticationFailed 

OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.

AuthenticationTicketExpired 

The authentication ticket should provide access to any Photon Cloud server without doing another authentication-service call. However, the ticket expired.

MaxCcuReached 

OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.

InvalidRegion 

OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or master server address.

OperationNotAllowedInCurrentState 

OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.

DisconnectByClientLogic 

OnStatusChanged: The client disconnected from within the logic (the C# code).

DisconnectByOperationLimit 

The client called an operation too frequently and got disconnected due to hitting the OperationLimit. This triggers a client-side disconnect, too.

To protect the server, some operations have a limit. When an OperationResponse fails with ErrorCode.OperationLimitReached, the client disconnects.

DisconnectByDisconnectMessage 

The client received a "Disconnect Message" from the server. Check the debug logs for details.

◆ EncryptionMode

Defines how the communication gets encrypted.

Enumerator
PayloadEncryption 

This is the default encryption mode: Messages get encrypted only on demand (when you send operations with the "encrypt" parameter set to true).

DatagramEncryption 

With this encryption mode for UDP, the connection gets setup and all further datagrams get encrypted almost entirely. On-demand message encryption (like in PayloadEncryption) is unavailable.

DatagramEncryptionRandomSequence 

With this encryption mode for UDP, the connection gets setup with random sequence numbers and all further datagrams get encrypted almost entirely. On-demand message encryption (like in PayloadEncryption) is unavailable.

DatagramEncryptionGCMRandomSequence 

Same as above except that GCM mode is used to encrypt data

◆ EventCaching

enum Photon.Realtime.EventCaching : byte
strong

Lite - OpRaiseEvent allows you to cache events and automatically send them to joining players in a room. Events are cached per event code and player: Event 100 (example!) can be stored once per player. Cached events can be modified, replaced and removed.

Caching works only combination with ReceiverGroup options Others and All.

Enumerator
DoNotCache 

Default value (not sent).

MergeCache 

Will merge this event's keys with those already cached.

ReplaceCache 

Replaces the event cache for this eventCode with this event's content.

RemoveCache 

Removes this event (by eventCode) from the cache.

AddToRoomCache 

Adds an event to the room's cache

AddToRoomCacheGlobal 

Adds this event to the cache for actor 0 (becoming a "globally owned" event in the cache).

RemoveFromRoomCache 

Remove fitting event from the room's cache.

RemoveFromRoomCacheForActorsLeft 

Removes events of players who already left the room (cleaning up).

SliceIncreaseIndex 

Increase the index of the sliced cache.

SliceSetIndex 

Set the index of the sliced cache. You must set RaiseEventOptions.CacheSliceIndex for this.

SlicePurgeIndex 

Purge cache slice with index. Exactly one slice is removed from cache. You must set RaiseEventOptions.CacheSliceIndex for this.

SlicePurgeUpToIndex 

Purge cache slices with specified index and anything lower than that. You must set RaiseEventOptions.CacheSliceIndex for this.

◆ JoinMode

enum Photon.Realtime.JoinMode : byte
strong

Defines possible values for OpJoinRoom and OpJoinOrCreate. It tells the server if the room can be only be joined normally, created implicitly or found on a web-service for Turnbased games.

These values are not directly used by a game but implicitly set.

Enumerator
Default 

Regular join. The room must exist.

CreateIfNotExists 

Join or create the room if it's not existing. Used for OpJoinOrCreate for example.

JoinOrRejoin 

The room might be out of memory and should be loaded (if possible) from a Turnbased web-service.

RejoinOnly 

Only re-join will be allowed. If the user is not yet in the room, this will fail.

◆ LobbyType

enum Photon.Realtime.LobbyType : byte
strong

Types of lobbies define their behaviour and capabilities. Check each value for details.

Values of this enum must be matched by the server.

Enumerator
Default 

Standard type and behaviour: While joined to this lobby clients get room-lists and JoinRandomRoom can use a simple filter to match properties (perfectly).

SqlLobby 

This lobby type lists rooms like Default but JoinRandom has a parameter for SQL-like "where" clauses for filtering. This allows bigger, less, or and and combinations.

AsyncRandomLobby 

This lobby does not send lists of games. It is only used for OpJoinRandomRoom. It keeps rooms available for a while when there are only inactive users left.

◆ MatchmakingMode

enum Photon.Realtime.MatchmakingMode : byte
strong

Options for matchmaking rules for OpJoinRandom.

Enumerator
FillRoom 

Fills up rooms (oldest first) to get players together as fast as possible. Default.

Makes most sense with MaxPlayers > 0 and games that can only start with more players.

SerialMatching 

Distributes players across available rooms sequentially but takes filter into account. Without filter, rooms get players evenly distributed.

RandomMatching 

Joins a (fully) random room. Expected properties must match but aside from this, any available room might be selected.

◆ PropertyTypeFlag

Flags for "types of properties", being used as filter in OpGetProperties.

Enumerator
None 

(0x00) Flag type for no property type.

Game 

(0x01) Flag type for game-attached properties.

Actor 

(0x02) Flag type for actor related propeties.

GameAndActor 

(0x01) Flag type for game AND actor properties. Equal to 'Game'

◆ ReceiverGroup

enum Photon.Realtime.ReceiverGroup : byte
strong

Lite - OpRaiseEvent lets you chose which actors in the room should receive events. By default, events are sent to "Others" but you can overrule this.

Enumerator
Others 

Default value (not sent). Anyone else gets my event.

All 

Everyone in the current room (including this peer) will get this event.

MasterClient 

The server sends this event only to the actor with the lowest actorNumber.

The "master client" does not have special rights but is the one who is in this room the longest time.

◆ ServerConnection

Available server (types) for internally used field: server.

Photon uses 3 different roles of servers: Name Server, Master Server and Game Server.

Enumerator
MasterServer 

This server is where matchmaking gets done and where clients can get lists of rooms in lobbies.

GameServer 

This server handles a number of rooms to execute and relay the messages between players (in a room).

NameServer 

This server is used initially to get the address (IP) of a Master Server for a specific region. Not used for Photon OnPremise (self hosted).