Fusion.Realtime
Responsible for running a thread that will keep the LoadBalancingClient connected to the Cloud
when the application is in the background
Fusion Realtime Client
This will deal with all communication done with the Photon Cloud
Fusion Realtime Client
This will deal with all communication done with the Photon Cloud
Reference to the background connection handler
Starts a new thread to send ACK to Cloud
Stops the currently running background thread.
Handles all received events from the Photon Cloud
Event Data
Send data to another Actor on the Room
Target Actor of the Event
Event Code
Data to be sent
Buffer Length
Flag to set reliability on the Event
True if the event was sent, false otherwise
Utility method used to extract the content of a from a object holder.
This is necessary so there are no references of Photon Lib DLLs other than on the Fusion.Realtime project
Data Object Holder, this must be a reference of a
Buffer to write the content of the array slice
Output size of the written buffer
True if the extraction was done correctly, false otherwise
Fusion Plugin Name for request
Alternative Name Server for CN Region
Flag to signal if the Client is Ready to perform cloud action and it is in a Room
Flag to signal if the Photon Cloud connection is encrypted by default
Signal if some room property has changed
Set if the Client should use the Default or Alternative Photon Cloud Ports
Try to load the first implementation of found in the current AppDomain
Type of the first implementation of found
Change the Custom Properties of the current Room
New set of Custom Properties
True if the change was made, false otherwise
Change the IsVisible Property of the current Room
New value of IsVisible
True if the change was made, false otherwise
Change the IsOpen Property of the current Room
New value of IsOpen
True if the change was made, false otherwise
Used to keep the client communication
Build a new EnterRoomParams ref using the default configs and optional Room Name
Which lobby the Room should exits
Room Name, if not set, a Random Name will be used
Set the max number of players per Session
Optional Room Custom Properties
Signal if the Session should be Open/Closed
Signal if the Session should Visible/Invisible
Signal fi the Default EmptyRoomTTL (0) should be used or a custom one
EnterRoomParams reference.
Build a new OpJoinRandomRoomParams that will be used to setup which Room the local peer wants to join
Type of Lobby to search rooms
Optional list of filter parameters
Optional Matchmaking Mode
OpJoinRandomRoomParams reference
Convert a into a pair of and respectively
representing the custom properties of a session and the property names that will be published on the Lobby
Dictionary to be converted
Hashtable with all allowed Custom Properties
String array with all public key names
Connect to master server.
Client
App settings
Runs client.Service() during the operation
Optional external cancellation token
When connected to master server callback was called.
Is thrown when the connection terminated
Is thrown when the authentication failed
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Asynchronously reconnects and rejoins a room.
The client that is reconnecting and rejoining.
Indicates whether to throw an exception on error. Defaults to true.
Indicates whether to run the client's service during the operation. Defaults to true.
An optional cancellation token that can be used to cancel the operation. Defaults to an empty cancellation token.
A task that represents the asynchronous operation. The task result is a boolean indicating whether the operation was successful.
Thrown when the client is still connected or when the reconnecting operation fails to start.
Thrown when the connection is terminated during the operation.
Thrown when the operation completes unsuccessfully.
Thrown when the operation times out.
Disconnects the client.
Client.
Runs client.Service() during the operation
Optional external cancellation token
Returns when the client has successfully disconnected
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Create and join a room.
Client object
Enter room params
Set ErrorCode as result on RoomCreateFailed or RoomJoinFailed
Runs client.Service() during the operation
Optional external cancellation token
When the room has been entered
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Create or Join a Room.
Client object
Enter room params
Set ErrorCode as result on RoomCreateFailed or RoomJoinFailed
Runs client.Service() during the operation
Optional external cancellation token
When the room has been entered
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Join room.
Client object
Enter room params
Set ErrorCode as result when JoinRoomFailed
Runs client.Service() during the operation
Optional external cancellation token
When room has been entered
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Join random or Create room
Client object
Join random room params
Enter room params
Set ErrorCode as result when operation fails with ErrorCode
Runs client.Service() during the operation
Optional external cancellation token
When inside a room
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Join a Random Room
Client object
Join random room params
Set ErrorCode as result when operation fails with ErrorCode
Runs client.Service() during the operation
Optional external cancellation token
When inside a room
Is thrown when the connection terminated
Is thrown when the operation could not be started
Is thrown when the operation completed unsuccessfully
Is thrown when the operation timed out
Join a Lobby
Client object
Lobby to join
Set ErrorCode as result when operation fails with ErrorCode
Runs client.Service() during the operation
Optional external cancellation token
When inside a Lobby
Create a instance, sets up the Photon callbacks, schedules removing them, create a connection service task.
The handler will monitor the Photon callbacks and complete, fault accordingly.
Use the callbacks to change the default handling.
can complete with ErrorCode.Ok, exception on errors and a timeout .
Client
The default implementation will throw an exception on every unexpected result, set this to false to return a result instead
Runs client.Service() during the operation
Optional external cancellation token
Photon Connection Handler object
Starts a task that calls every updateIntervalMs milliseconds.
The task is stopped by the cancellation token from .
It will set an exception on the TaskCompletionSource if after the timeout it is still not completed.
Client
Cancellation token to stop the update loop
Completion source is notified on an exception in Service()
Convert a into a
Convert a into a
Calculate the total size a would take when serialized
Hashtable to check the size
Total size of the Hashtable in serialized format
Convert the Room Custom Properties into a
RoomInfo to extract the custom properties
with the data
Calculate the total size a would take when serialized
Dictionary to check the size
Total size of the Dictionary in serialized format
Settings for Photon application(s) and the server to connect to.
This is Serializable for Unity, so it can be included in ScriptableObject instances.
AppId for Realtime or PUN.
AppId for Photon Fusion.
AppId for Photon Chat.
AppId for Photon Voice.
The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for matchmaking).
If false, the app will attempt to connect to a Master Server (which is obsolete but sometimes still necessary).
if true, Server points to a NameServer (or is null, using the default), else it points to a MasterServer.
Can be set to any of the Photon Cloud's region names to directly connect to that region.
if this IsNullOrEmpty() AND UseNameServer == true, use BestRegion. else, use a server
Set to a previous BestRegionSummary value before connecting.
This is a value used when the client connects to the "Best Region".
If this is null or empty, all regions gets pinged. Providing a previous summary on connect,
speeds up best region selection and makes the previously selected region "sticky".
Unity clients should store the BestRegionSummary in the PlayerPrefs.
You can store the new result by implementing .
If is not null, store this string.
To avoid storing the value multiple times, you could set SummaryToCache to null.
The address (hostname or IP) of the server to connect to.
If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed).
The address (hostname or IP and port) of the proxy server.
The network level protocol to use.
Enables a fallback to another protocol in case a connect to the Name Server fails.
See: LoadBalancingClient.EnableProtocolFallback.
Defines how authentication is done. On each system, once or once via a WSS connection (safe).
If true, the client will request the list of currently available lobbies.
Log level for the network lib.
If true, the Server field contains a Master Server address (if any address at all).
If true, the client should fetch the region list from the Name Server and find the one with best ping.
See "Best Region" in the online docs.
If true, the default nameserver address for the Photon Cloud should be used.
If true, the default ports for a protocol will be used.
ToString but with more details.
Checks if a string is a Guid by attempting to create one.
The potential guid to check.
True if new Guid(val) did not fail.
Get a Copy from the into a new instance.
Copy of
Photon client to log information and statistics from.
Option to let the fallback thread call Disconnect after the KeepAliveInBackground time. Default: false.
If set to true, the thread will disconnect the client regularly, should the client not call SendOutgoingCommands / Service.
This may happen due to an app being in background (and not getting a lot of CPU time) or when loading assets.
If false, a regular timeout time will have to pass (on top) to time out the client.
Defines for how long the Fallback Thread should keep the connection, before it may time out as usual.
We want to the Client to keep it's connection when an app is in the background (and doesn't call Update / Service Clients should not keep their connection indefinitely in the background, so after some milliseconds, the Fallback Thread should stop keeping it up.
Counts how often the Fallback Thread called SendAcksOnly, which is purely of interest to monitor if the game logic called SendOutgoingCommands as intended.
True if a fallback thread is running. Will call the client's SendAcksOnly() method to keep the connection up.
Keeps the ConnectionHandler, even if a new scene gets loaded.
Indicates that the app is closing. Set in OnApplicationQuit().
Resets statics for Domain Reload
Called by Unity when the application gets closed. Disconnects if OnApplicationQuit() was called before.
Called by Unity when the application gets closed. The UnityEngine will also call OnDisable, which disconnects.
Called by Unity when the application gets paused or resumed.
Called by Unity when the application changes focus.
When run in Unity, this returns Application.internetReachability != NetworkReachability.NotReachable.
Application.internetReachability != NetworkReachability.NotReachable
A thread which runs independent from the Update() calls. Keeps connections online while loading or in background. See .
Internally used class, containing de/serialization methods for various Unity-specific classes.
Adding those to the Photon serialization protocol allows you to send them in events, etc.
Register de/serializer methods for Unity specific types. Makes the types usable in RaiseEvent and PUN.
This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).
Merges all keys from addHash into the target. Adds new keys and updates the values of existing keys in target.
The IDictionary to update.
The IDictionary containing data to merge into target.
Merges keys of type string to target Hashtable.
Does not remove keys from target (so non-string keys CAN be in target if they were before).
The target IDictionary passed in plus all string-typed keys from the addHash.
A IDictionary that should be merged partly into target to update it.
Helper method for debugging of IDictionary content, including type-information. Using this is not performant.
Should only be used for debugging as necessary.
Some Dictionary or Hashtable.
String of the content of the IDictionary.
Helper method for debugging of content. Using this is not performant.
Should only be used for debugging as necessary.
Any where T implements .ToString().
A comma-separated string containing each value's ToString().
Helper method for debugging of object[] content. Using this is not performant.
Should only be used for debugging as necessary.
Any object[].
A comma-separated string containing each value's ToString().
This method copies all string-typed keys of the original into a new Hashtable.
Does not recurse (!) into hashes that might be values in the root-hash.
This does not modify the original.
The original IDictonary to get string-typed keys from.
New Hashtable containing only string-typed keys of the original.
This method copies all string-typed keys of the original into a new Hashtable.
Does not recurse (!) into hashes that might be values in the root-hash.
This does not modify the original.
The original IDictonary to get string-typed keys from.
New Hashtable containing only string-typed keys of the original.
Used by StripKeysWithNullValues.
By making keysWithNullValue a static variable to clear before using, allocations only happen during the warm-up phase
as the list needs to grow. Once it hit the high water mark for keys you need to remove.
Removes all keys with null values.
Photon properties are removed by setting their value to null. Changes the original IDictionary!
Uses lock(keysWithNullValue), which should be no problem in expected use cases.
The IDictionary to strip of keys with null value.
Removes all keys with null values.
Photon properties are removed by setting their value to null. Changes the original IDictionary!
Uses lock(keysWithNullValue), which should be no problem in expected use cases.
The IDictionary to strip of keys with null value.
Checks if a particular integer value is in an int-array.
This might be useful to look up if a particular actorNumber is in the list of players of a room.
The array of ints to check.
The number to lookup in target.
True if nr was found in target.
Used to store info about a friend's online state and in which room he/she is.
State values for a client, which handles switching Photon server types, some operations, etc.
\ingroup publicApi
Peer is created but not used yet.
Transition state while connecting to a server. On the Photon Cloud this sends the AppId and AuthenticationValues (UserID).
Not Used.
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.
The client is in a lobby, connected to the MasterServer. Depending on the lobby, it gets room listings.
Transition from MasterServer to GameServer.
Transition to GameServer (client authenticates and joins/creates a room).
Connected to GameServer (going to auth and join game).
Transition state while joining or creating a room on GameServer.
The client entered a room. The CurrentRoom and Players are known and you can now raise events.
Transition state when leaving a room.
Transition from GameServer to MasterServer (after leaving a room/game).
Connecting to MasterServer (includes sending authentication values).
The client disconnects (from any server). This leads to state Disconnected.
The client is no longer connected (to any server). Connect to MasterServer to go on.
Connected to MasterServer. You might use matchmaking or join a lobby now.
Client connects to the NameServer. This process includes low level connecting and setting up encryption. When done, state becomes ConnectedToNameServer.
Client is connected to the NameServer and established encryption already. You should call OpGetRegions or ConnectToRegionMaster.
Clients disconnects (specifically) from the NameServer (usually to connect to the MasterServer).
Client was unable to connect to Name Server and will attempt to connect with an alternative network protocol (TCP).
Internal state, how this peer gets into a particular room (joining it or creating it).
This client creates a room, gets into it (no need to join) and can set room properties.
The room existed already and we join into it (not setting room properties).
Done on Master Server and (if successful) followed by a Join on Game Server.
Done on Master Server and (if successful) followed by a Join or Create on Game Server.
Client is either joining or creating a room. On Master- and Game-Server.
Enumeration of causes for Disconnects (used in LoadBalancingClient.DisconnectedCause).
Read the individual descriptions to find out what to do about this type of disconnect.
No error was tracked.
OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.
OnStatusChanged: Dns resolution for a hostname failed. The exception for this is being caught and logged with error level.
OnStatusChanged: The server address was parsed as IPv4 illegally. An illegal address would be e.g. 192.168.1.300. IPAddress.TryParse() will let this pass but our check won't.
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.
Send exception.
Receive exception.
OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgement from the client).
OnStatusChanged: This client detected that the server's responses are not received in due time.
OnStatusChanged: The server disconnected this client from within the room's logic (the C# code).
OnStatusChanged: The server disconnected this client for unknown reasons.
OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.
OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.
The authentication ticket should provide access to any Photon Cloud server without doing another authentication-service call. However, the ticket expired.
OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.
OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or master server address.
OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.
OnStatusChanged: The client disconnected from within the logic (the C# code).
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.
The client received a "Disconnect Message" from the server. Check the debug logs for details.
Used in case the application quits. Can be useful to not load new scenes or re-connect in OnDisconnected.
ConnectionHandler.OnDisable() will use this, if the Unity engine already called OnApplicationQuit (ConnectionHandler.AppQuits = true).
Available server (types) for internally used field: server.
Photon uses 3 different roles of servers: Name Server, Master Server and Game Server.
This server is where matchmaking gets done and where clients can get lists of rooms in lobbies.
This server handles a number of rooms to execute and relay the messages between players (in a room).
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).
Defines which sort of app the LoadBalancingClient is used for: Realtime or Voice.
Realtime apps are for gaming / interaction. Also used by PUN 2.
Voice apps stream audio.
Fusion clients are for matchmaking and relay in Photon Fusion.
Defines how the communication gets encrypted.
This is the default encryption mode: Messages get encrypted only on demand (when you send operations with the "encrypt" parameter set to true).
Datagram Encryption with GCM.
Container for port definitions.
Typical ports: UDP: 5058 or 27000, TCP: 4533, WSS: 19093 or 443.
Typical ports: UDP: 5056 or 27002, TCP: 4530, WSS: 19090 or 443.
Typical ports: UDP: 5055 or 27001, TCP: 4531, WSS: 19091 or 443.
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.
This class (and the Player class) should be extended to implement your own game logic.
You can override CreatePlayer as "factory" method for Players and return your own Player instances.
The State of this class is essential to know when a client is in a lobby (or just on the master)
and when in a game where the actual gameplay should take place.
Extension notes:
An extension of this class should override the methods of the IPhotonPeerListener, as they
are called when the state changes. Call base.method first, then pick the operation or state you
want to react to and put it in a switch-case.
We try to provide demo to each platform where this api can be used, so lookout for those.
The client uses a LoadBalancingPeer as API to communicate with the server.
This is public for ease-of-use: Some methods like OpRaiseEvent are not relevant for the connection state and don't need a override.
Gets or sets the binary protocol version used by this client
Use this always instead of setting it via
() directly, especially when WSS protocol is used.
The version of your client. A new version also creates a new "virtual app" to separate players from older client versions.
The AppID as assigned from the Photon Cloud. If you host yourself, this is the "regular" Photon Server Application Name (most likely: "LoadBalancing").
The ClientAppType defines which sort of AppId should be expected. The LoadBalancingClient supports Realtime and Voice app types. Default: Realtime.
User authentication values to be sent to the Photon server right after connecting.
Set this property or pass AuthenticationValues by Connect(..., authValues).
Enables the new Authentication workflow.
Defines how the communication gets encrypted.
Optionally contains a protocol which will be used on Master- and GameServer.
When using AuthMode = AuthModeOption.AuthOnceWss, the client uses a wss-connection on the NameServer but another protocol on the other servers.
As the NameServer sends an address, which is different per protocol, it needs to know the expected protocol.
This is nullable by design. In many cases, the protocol on the NameServer is not different from the other servers.
If set, the operation AuthOnce will contain this value and the OpAuth response on the NameServer will execute a protocol switch.
Simplifies getting the token for connect/init requests, if this feature is enabled.
Internally used cache for the server's token. Identifies a user/session and can be used to rejoin.
True if this client uses a NameServer to get the Master Server address.
This value is public, despite being an internal value, which should only be set by this client.
Name Server Host Name for Photon Cloud. Without port and without any prefix.
Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value.
Name Server port per protocol (the UDP port is different than TCP, etc).
Replaced by ServerPortOverrides.
Defines overrides for server ports. Used per server-type if > 0. Important: You must change these when the protocol changes!
Typical ports are listed in PhotonPortDefinition.
Instead of using the port provided from the servers, the specified port is used (independent of the protocol).
If a value is 0 (default), the port is not being replaced.
Different protocols have different typical ports per server-type.
https://doc.photonengine.com/en-us/pun/current/reference/tcp-and-udp-port-numbers
In case of using the AuthMode AutOnceWss, the name server's protocol is wss, while udp or tcp will be used on the master server and game server.
Set the ports accordingly per protocol and server.
Enables a fallback to another protocol in case a connect to the Name Server fails.
When connecting to the Name Server fails for a first time, the client will select an alternative
network protocol and re-try to connect.
The fallback will use the default Name Server port as defined by ProtocolToNameServerPort.
The fallback for TCP is UDP. All other protocols fallback to TCP.
The currently used server address (if any). The type of server is define by Server property.
Your Master Server address. In PhotonCloud, call ConnectToRegionMaster() to find your Master Server.
In the Photon Cloud, explicit definition of a Master Server Address is not best practice.
The Photon Cloud has a "Name Server" which redirects clients to a specific Master Server (per Region and AppId).
The game server's address for a particular room. In use temporarily, as assigned by master.
The server this client is currently connected or connecting to.
Each server (NameServer, MasterServer, GameServer) allow some operations and reject others.
Defines a proxy URL for WebSocket connections. Can be the proxy or point to a .pac file.
This URL supports various definitions:
"user:pass@proxyaddress:port"
"proxyaddress:port"
"system:"
"pac:"
"pac:http://host/path/pacfile.pac"
Important: Don't define a protocol, except to point to a pac file. the proxy address should not begin with http:// or https://.
Backing field for property.
Current state this client is in. Careful: several states are "transitions" that lead to other states.
Returns if this client is currently connected or connecting to some type of server.
This is even true while switching servers. Use IsConnectedAndReady to check only for those states that enable you to send Operations.
A refined version of IsConnected which is true only if your connection is ready to send operations.
Not all operations can be called on all types of servers. If an operation is unavailable on the currently connected server,
this will result in a OperationResponse with ErrorCode != 0.
Examples: The NameServer allows OpGetRegions which is not available anywhere else.
The MasterServer does not allow you to send events (OpRaiseEvent) and on the GameServer you are unable to join a lobby (OpJoinLobby).
To check which server you are on, use: .
Register a method to be called when this client's ClientState gets set.
This can be useful to react to being connected, joined into a room, etc.
Register a method to be called when an event got dispatched. Gets called after the LoadBalancingClient handled the internal events first.
This is an alternative to extending LoadBalancingClient to override OnEvent().
Note that OnEvent is calling EventReceived after it handled internal events first.
That means for example: Joining players will already be in the player list but leaving
players will already be removed from the room.
Register a method to be called when an operation response is received.
This is an alternative to extending LoadBalancingClient to override OnOperationResponse().
Note that OnOperationResponse gets executed before your Action is called.
That means for example: The OpJoinLobby response already set the state to "JoinedLobby"
and the response to OpLeave already triggered the Disconnect before this is called.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Wraps up the target objects for a group of callbacks, so they can be called conveniently.
By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
Summarizes (aggregates) the different causes for disconnects of a client.
A disconnect can be caused by: errors in the network connection or some vital operation failing
(which is considered "high level"). While operations always trigger a call to OnOperationResponse,
connection related changes are treated in OnStatusChanged.
The DisconnectCause is set in either case and summarizes the causes for any disconnect in a single
state value which can be used to display (or debug) the cause for disconnection.
After a to a connection loss or timeout, this summarizes the most relevant system conditions which might have contributed to the loss.
Internal value if the client is in a lobby.
This is used to re-set this.State, when joining/creating a room fails.
The lobby this client currently uses. Defined when joining a lobby or creating rooms
If enabled, the client will get a list of available lobbies from the Master Server.
Set this value before the client connects to the Master Server. While connected to the Master
Server, a change has no effect.
Implement OptionalInfoCallbacks.OnLobbyStatisticsUpdate, to get the list of used lobbies.
The lobby statistics can be useful if your title dynamically uses lobbies, depending (e.g.)
on current player activity or such.
In this case, getting a list of available lobbies, their room-count and player-count can
be useful info.
ConnectUsingSettings sets this to the PhotonServerSettings value.
Internal lobby stats cache, used by LobbyStatistics.
The local player is never null but not valid unless the client is in a room, too. The ID will be -1 outside of rooms.
The nickname of the player (synced with others). Same as client.LocalPlayer.NickName.
An ID for this user. Sent in OpAuthenticate when you connect. If not set, the PlayerName is applied during connect.
On connect, if the UserId is null or empty, the client will copy the PlayName to UserId. If PlayerName is not set either
(before connect), the server applies a temporary ID which stays unknown to this client and other clients.
The UserId is what's used in FindFriends and for fetching data for your account (with WebHooks e.g.).
By convention, set this ID before you connect, not while being connected.
There is no error but the ID won't change while being connected.
The current room this client is connected to (null if none available).
Is true while being in a room (this.state == ClientState.Joined).
Aside from polling this value, game logic should implement IMatchmakingCallbacks in some class
and react when that gets called.
OpRaiseEvent, OpLeave and some other operations can only be used (successfully) when the client is in a room..
Statistic value available on master server: Players on master (looking for games).
Statistic value available on master server: Players in rooms (playing).
Statistic value available on master server: Rooms currently created.
Internally used to decide if a room must be created or joined on game server.
Used when the client arrives on the GS, to join the room with the correct values.
Used to cache a failed "enter room" operation on the Game Server, to return to the Master Server before calling a fail-callback.
Maximum of userIDs that can be sent in one friend list request.
Contains the list of names of friends to look up their state on the server.
Internal flag to know if the client currently fetches a friend list.
The cloud region this client connects to. Set by ConnectToRegionMaster(). Not set if you don't use a NameServer!
The cluster name provided by the Name Server.
The value is provided by the OpResponse for OpAuthenticate/OpAuthenticateOnce.
Default: null. This value only ever updates from the Name Server authenticate response.
Contains the list if enabled regions this client may use. Null, unless the client got a response to OpGetRegions.
Stores the best region summary of a previous session to speed up connecting.
Set when the best region pinging is done.
Internal connection setting/flag. If the client should connect to the best region or not.
It's set in the Connect...() methods. Only ConnectUsingSettings() sets it to true.
If true, client will ping available regions and select the best.
A bestRegionSummaryFromStorage can be used to cut the ping time short.
Definition of parameters for encryption data (included in Authenticate operation response).
Key for encryption mode
Key for first secret
Key for second secret
Add if true, remove if false.
Creates a LoadBalancingClient with UDP protocol or the one specified.
Specifies the network protocol to use for connections.
Creates a LoadBalancingClient, setting various values needed before connecting.
The Master Server's address to connect to. Used in Connect.
The AppId of this title. Needed for the Photon Cloud. Find it in the Dashboard.
A version for this client/build. In the Photon Cloud, players are separated by AppId, GameVersion and Region.
Specifies the network protocol to use for connections.
Gets the NameServer Address (with prefix and port), based on the set protocol (this.LoadBalancingPeer.UsedProtocol).
NameServer Address (with prefix and port).
Starts the "process" to connect as defined by the appSettings (AppId, AppVersion, Transport Protocol, Port and more).
A typical connection process wraps up these steps:
- Low level connect and init (which establishes a connection that enables operations and responses for the Realtime API).
- GetRegions and select best (unless FixedRegion is being used).
- Authenticate user for a specific region (this provides a Master Server address to go to and a token).
- Disconnect Name Server and connect to Master Server (using the token).
- The callback OnConnectedToMaster gets called.
Connecting to the servers is a process and this is a non-blocking method.
Implement and register the IConnectionCallbacks interface to get callbacks about success or failing connects.
Basically all settings for the connection, AppId and servers can be done via the provided parameter.
Connecting to the Photon Cloud might fail due to:
- Network issues
- Region not available
- Subscription CCU limit
Collection of settings defining this app and how to connect.
True if the client can attempt to connect.
Starts the "process" to connect to a Master Server, using MasterServerAddress and AppId properties.
To connect to the Photon Cloud, use ConnectUsingSettings() or ConnectToRegionMaster().
The process to connect includes several steps: the actual connecting, establishing encryption, authentification
(of app and optionally the user) and connecting to the MasterServer
Users can connect either anonymously or use "Custom Authentication" to verify each individual player's login.
Custom Authentication in Photon uses external services and communities to verify users. While the client provides a user's info,
the service setup is done in the Photon Cloud Dashboard.
The parameter authValues will set this.AuthValues and use them in the connect process.
Connecting to the Photon Cloud might fail due to:
- Network issues (OnStatusChanged() StatusCode.ExceptionOnConnect)
- Region not available (OnOperationResponse() for OpAuthenticate with ReturnCode == ErrorCode.InvalidRegion)
- Subscription CCU limit reached (OnOperationResponse() for OpAuthenticate with ReturnCode == ErrorCode.MaxCcuReached)
Connects to the NameServer for Photon Cloud, where a region and server list can be obtained.
If the workflow was started or failed right away.
Connects you to a specific region's Master Server, using the Name Server to get the IP.
If the region is null or empty, no connection will be made.
If the region (code) provided is not available, the connection process will fail on the Name Server.
This method connects only to the region defined. Any "Best Region" pinging should get done beforehand.
To support "sharding", a region string may contain a "/*" to pick a random cluster or "/clustername"
to connect to a specific cluster.
With a "/" or no cluster postfix, the client connects to the default cluster (a specific one
for a region).
By default, the region string provided by the Name Server does not contain a cluster (and only the
default cluster is used).
If the operation could be sent. If false, no operation was sent.
Privately used only for reconnecting.
Can be used to reconnect to the master server after a disconnect.
Common use case: Press the Lock Button on a iOS device and you get disconnected immediately.
Can be used to return to a room quickly by directly reconnecting to a game server to rejoin a room.
Rejoining room will not send any player properties. Instead client will receive up-to-date ones from server.
If you want to set new player properties, do it once rejoined.
False, if the conditions are not met. Then, this client does not attempt the ReconnectAndRejoin.
Disconnects the peer from a server or stays disconnected. If the client / peer was connected, a callback will be triggered.
Disconnect will attempt to notify the server of the client closing the connection.
Clients that are in a room, will leave the room. If the room's playerTTL > 0, the player will just become inactive (and may rejoin).
This method will not change the current State, if this client State is PeerCreated, Disconnecting or Disconnected.
In those cases, there is also no callback for the disconnect. The DisconnectedCause will only change if the client was connected.
Private Disconnect variant that sets the state, too.
Useful to test loss of connection which will end in a client timeout. This modifies LoadBalancingPeer.NetworkSimulationSettings. Read remarks.
Use with care as this sets LoadBalancingPeer.IsSimulationEnabled.
Read LoadBalancingPeer.IsSimulationEnabled to check if this is on or off, if needed.
If simulateTimeout is true, LoadBalancingPeer.NetworkSimulationSettings.IncomingLossPercentage and
LoadBalancingPeer.NetworkSimulationSettings.OutgoingLossPercentage will be set to 100.
Obviously, this overrides any network simulation settings done before.
If you want fine-grained network simulation control, use the NetworkSimulationSettings.
The timeout will lead to a call to , as usual in a client timeout.
You could modify this method (or use NetworkSimulationSettings) to deliberately run into a server timeout by
just setting the OutgoingLossPercentage = 100 and the IncomingLossPercentage = 0.
If true, a connection loss is simulated. If false, the simulation ends.
This method dispatches all available incoming commands and then sends this client's outgoing commands.
It uses DispatchIncomingCommands and SendOutgoingCommands to do that.
The Photon client libraries are designed to fit easily into a game or application. The application
is in control of the context (thread) in which incoming events and responses are executed and has
full control of the creation of UDP/TCP packages.
Sending packages and dispatching received messages are two separate tasks. Service combines them
into one method at the cost of control. It calls DispatchIncomingCommands and SendOutgoingCommands.
Call this method regularly (10..50 times a second).
This will Dispatch ANY received commands (unless a reliable command in-order is still missing) and
events AND will send queued outgoing commands. Fewer calls might be more effective if a device
cannot send many packets per second, as multiple operations might be combined into one package.
You could replace Service by:
while (DispatchIncomingCommands()); //Dispatch until everything is Dispatched...
SendOutgoingCommands(); //Send a UDP/TCP package with outgoing messages
While on the NameServer, this gets you the list of regional servers (short names and their IPs to ping them).
If the operation could be sent. If false, no operation was sent (e.g. while not connected to the NameServer).
Request the rooms and online status for a list of friends. All clients should set a unique UserId before connecting. The result is available in this.FriendList.
Used on Master Server to find the rooms played by a selected list of users.
The result will be stored in LoadBalancingClient.FriendList, which is null before the first server response.
Users identify themselves by setting a UserId in the LoadBalancingClient instance.
This will send the ID in OpAuthenticate during connect (to master and game servers).
Note: Changing a player's name doesn't make sense when using a friend list.
The list of usernames must be fetched from some other source (not provided by Photon).
Internal:
The server response includes 2 arrays of info (each index matching a friend from the request):
ParameterCode.FindFriendsResponseOnlineList = bool[] of online states
ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
The options may be used to define which state a room must match to be returned.
Array of friend's names (make sure they are unique).
Options that affect the result of the FindFriends operation.
If the operation could be sent (requires connection).
If already connected to a Master Server, this joins the specified lobby. This request triggers an OnOperationResponse() call and the callback OnJoinedLobby().
The lobby to join. Use null for default lobby.
If the operation could be sent. False, if the client is not IsConnectedAndReady or when it's not connected to a Master Server.
Opposite of joining a lobby. You don't have to explicitly leave a lobby to join another (client can be in one max, at any time).
If the operation could be sent (has to be connected).
Joins a random room that matches the filter. Will callback: OnJoinedRoom or OnJoinRandomFailed.
Used for random matchmaking. You can join any room or one with specific properties defined in opJoinRandomRoomParams.
You can use expectedCustomRoomProperties and expectedMaxPlayers as filters for accepting rooms.
If you set expectedCustomRoomProperties, a room must have the exact same key values set at Custom Properties.
You need to define which Custom Room Properties will be available for matchmaking when you create a room.
See: OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby)
This operation fails if no rooms are fitting or available (all full, closed or not visible).
It may also fail when actually joining the room which was found. Rooms may close, become full or empty anytime.
This method can only be called while the client is connected to a Master Server so you should
implement the callback OnConnectedToMaster.
Check the return value to make sure the operation will be called on the server.
Note: There will be no callbacks if this method returned false.
This client's State is set to ClientState.Joining immediately, when the operation could
be called. In the background, the client will switch servers and call various related operations.
When you're in the room, this client's State will become ClientState.Joined.
When entering a room, this client's Player Custom Properties will be sent to the room.
Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
Note that the player properties will be cached locally and are not wiped when leaving a room.
More about matchmaking:
https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby
You can define an array of expectedUsers, to block player slots in the room for these users.
The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
Optional definition of properties to filter rooms in random matchmaking.
If the operation could be sent currently (requires connection to Master Server).
Attempts to join a room that matches the specified filter and creates a room if none found.
This operation is a combination of filter-based random matchmaking with the option to create a new room,
if no fitting room exists.
The benefit of that is that the room creation is done by the same operation and the room can be found
by the very next client, looking for similar rooms.
There are separate parameters for joining and creating a room.
This method can only be called while connected to a Master Server.
This client's State is set to ClientState.Joining immediately.
For success, IMatchmakingCallbacks.OnJoinedRoom or IMatchmakingCallbacks.OnCreatedRoom get called.
In error cases IMatchmakingCallbacks.OnJoinRoomFailed or IMatchmakingCallbacks.OnJoinRandomRoomFailed get called.
More about matchmaking:
https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby
Check the return value to make sure the operation will be called on the server.
Note: There will be no callbacks if this method returned false.
If the operation will be sent (requires connection to Master Server).
Creates a new room. Will callback: OnCreatedRoom and OnJoinedRoom or OnCreateRoomFailed.
When successful, the client will enter the specified room and callback both OnCreatedRoom and OnJoinedRoom.
In all error cases, OnCreateRoomFailed gets called.
Creating a room will fail if the room name is already in use or when the RoomOptions clashing
with one another. Check the EnterRoomParams reference for the various room creation options.
This method can only be called while the client is connected to a Master Server so you should
implement the callback OnConnectedToMaster.
Check the return value to make sure the operation will be called on the server.
Note: There will be no callbacks if this method returned false.
When you're in the room, this client's State will become ClientState.Joined.
When entering a room, this client's Player Custom Properties will be sent to the room.
Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
Note that the player properties will be cached locally and are not wiped when leaving a room.
You can define an array of expectedUsers, to block player slots in the room for these users.
The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
Definition of properties for the room to create.
If the operation could be sent currently (requires connection to Master Server).
Joins a specific room by name and creates it on demand. Will callback: OnJoinedRoom or OnJoinRoomFailed.
Useful when players make up a room name to meet in:
All involved clients call the same method and whoever is first, also creates the room.
When successful, the client will enter the specified room.
The client which creates the room, will callback both OnCreatedRoom and OnJoinedRoom.
Clients that join an existing room will only callback OnJoinedRoom.
In all error cases, OnJoinRoomFailed gets called.
Joining a room will fail, if the room is full, closed or when the user
already is present in the room (checked by userId).
To return to a room, use OpRejoinRoom.
This method can only be called while the client is connected to a Master Server so you should
implement the callback OnConnectedToMaster.
Check the return value to make sure the operation will be called on the server.
Note: There will be no callbacks if this method returned false.
This client's State is set to ClientState.Joining immediately, when the operation could
be called. In the background, the client will switch servers and call various related operations.
When you're in the room, this client's State will become ClientState.Joined.
If you set room properties in roomOptions, they get ignored when the room is existing already.
This avoids changing the room properties by late joining players.
When entering a room, this client's Player Custom Properties will be sent to the room.
Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
Note that the player properties will be cached locally and are not wiped when leaving a room.
You can define an array of expectedUsers, to block player slots in the room for these users.
The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
Definition of properties for the room to create or join.
If the operation could be sent currently (requires connection to Master Server).
Joins a room by name. Will callback: OnJoinedRoom or OnJoinRoomFailed.
Useful when using lobbies or when players follow friends or invite each other.
When successful, the client will enter the specified room and callback via OnJoinedRoom.
In all error cases, OnJoinRoomFailed gets called.
Joining a room will fail if the room is full, closed, not existing or when the user
already is present in the room (checked by userId).
To return to a room, use OpRejoinRoom.
When players invite each other and it's unclear who's first to respond, use OpJoinOrCreateRoom instead.
This method can only be called while the client is connected to a Master Server so you should
implement the callback OnConnectedToMaster.
Check the return value to make sure the operation will be called on the server.
Note: There will be no callbacks if this method returned false.
A room's name has to be unique (per region, appid and gameversion).
When your title uses a global matchmaking or invitations (e.g. an external solution),
keep regions and the game versions in mind to join a room.
This client's State is set to ClientState.Joining immediately, when the operation could
be called. In the background, the client will switch servers and call various related operations.
When you're in the room, this client's State will become ClientState.Joined.
When entering a room, this client's Player Custom Properties will be sent to the room.
Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
Note that the player properties will be cached locally and are not wiped when leaving a room.
You can define an array of expectedUsers, to reserve player slots in the room for friends or party members.
The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
Definition of properties for the room to join.
If the operation could be sent currently (requires connection to Master Server).
Rejoins a room by roomName (using the userID internally to return). Will callback: OnJoinedRoom or OnJoinRoomFailed.
Used to return to a room, before this user was removed from the players list.
Internally, the userID will be checked by the server, to make sure this user is in the room (active or inactice).
In contrast to join, this operation never adds a players to a room. It will attempt to retake an existing
spot in the playerlist or fail. This makes sure the client doesn't accidentally join a room when the
game logic meant to re-activate an existing actor in an existing room.
This method will fail on the server, when the room does not exist, can't be loaded (persistent rooms) or
when the userId is not in the player list of this room. This will lead to a callback OnJoinRoomFailed.
Rejoining room will not send any player properties. Instead client will receive up-to-date ones from server.
If you want to set new player properties, do it once rejoined.
Leaves the current room, optionally telling the server that the user is just becoming inactive. Will callback: OnLeftRoom.
OpLeaveRoom skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already.
OpLeaveRoom returns false in those cases and won't change the state, so check return of this method.
In some cases, this method will skip the OpLeave call and just call Disconnect(),
which not only leaves the room but also the server. Disconnect also triggers a leave and so that workflow is is quicker.
If true, this player becomes inactive in the game and can return later (if PlayerTTL of the room is != 0).
WebFlag: Securely transmit the encrypted object AuthCookie to the web service in PathLeave webhook when available
If the current room could be left (impossible while not in a room).
Gets a list of rooms matching the (non empty) SQL filter for the given SQL-typed lobby.
Operation is only available for lobbies of type SqlLobby and the filter can not be empty.
It will check those conditions and fail locally, returning false.
This is an async request which triggers a OnOperationResponse() call.
The lobby to query. Has to be of type SqlLobby.
The sql query statement.
If the operation could be sent (has to be connected).
Updates and synchronizes a Player's Custom Properties. Optionally, expectedProperties can be provided as condition.
Custom Properties are a set of string keys and arbitrary values which is synchronized
for the players in a Room. They are available when the client enters the room, as
they are in the response of OpJoin and OpCreate.
Custom Properties either relate to the (current) Room or a Player (in that Room).
Both classes locally cache the current key/values and make them available as
property: CustomProperties. This is provided only to read them.
You must use the method SetCustomProperties to set/modify them.
Any client can set any Custom Properties anytime (when in a room).
It's up to the game logic to organize how they are best used.
You should call SetCustomProperties only with key/values that are new or changed. This reduces
traffic and performance.
Unless you define some expectedProperties, setting key/values is always permitted.
In this case, the property-setting client will not receive the new values from the server but
instead update its local cache in SetCustomProperties.
If you define expectedProperties, the server will skip updates if the server property-cache
does not contain all expectedProperties with the same values.
In this case, the property-setting client will get an update from the server and update it's
cached key/values at about the same time as everyone else.
The benefit of using expectedProperties can be only one client successfully sets a key from
one known value to another.
As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
take the item will have it (and the others fail to set the ownership).
Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
Defines which player the Custom Properties belong to. ActorID of a player.
Hashtable of Custom Properties that changes.
Provide some keys/values to use as condition for setting the new values. Client must be in room.
Defines if the set properties should be forwarded to a WebHook. Client must be in room.
False if propertiesToSet is null or empty or have zero string keys.
If not in a room, returns true if local player and expectedProperties and webFlags are null.
False if actorNr is lower than or equal to zero.
Otherwise, returns if the operation could be sent to the server.
Internally used to cache and set properties (including well known properties).
Requires being in a room (because this attempts to send an operation which will fail otherwise).
Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition.
Custom Properties are a set of string keys and arbitrary values which is synchronized
for the players in a Room. They are available when the client enters the room, as
they are in the response of OpJoin and OpCreate.
Custom Properties either relate to the (current) Room or a Player (in that Room).
Both classes locally cache the current key/values and make them available as
property: CustomProperties. This is provided only to read them.
You must use the method SetCustomProperties to set/modify them.
Any client can set any Custom Properties anytime (when in a room).
It's up to the game logic to organize how they are best used.
You should call SetCustomProperties only with key/values that are new or changed. This reduces
traffic and performance.
Unless you define some expectedProperties, setting key/values is always permitted.
In this case, the property-setting client will not receive the new values from the server but
instead update its local cache in SetCustomProperties.
If you define expectedProperties, the server will skip updates if the server property-cache
does not contain all expectedProperties with the same values.
In this case, the property-setting client will get an update from the server and update it's
cached key/values at about the same time as everyone else.
The benefit of using expectedProperties can be only one client successfully sets a key from
one known value to another.
As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
take the item will have it (and the others fail to set the ownership).
Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
Hashtable of Custom Properties that changes.
Provide some keys/values to use as condition for setting the new values.
Defines web flags for an optional PathProperties webhook.
False if propertiesToSet is null or empty or have zero string keys.
Otherwise, returns if the operation could be sent to the server.
Internally used to cache and set properties (including well known properties).
Requires being in a room (because this attempts to send an operation which will fail otherwise).
Send an event with custom code/type and any content to the other players in the same room.
Identifies this type of event (and the content). Your game's event codes can start with 0.
Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
Contains used send options. If you pass null, the default options will be used.
Send options for reliable, encryption etc
If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
Operation to handle this client's interest groups (for events in room).
Note the difference between passing null and byte[0]:
null won't add/remove any groups.
byte[0] will add/remove all (existing) groups.
First, removing groups is executed. This way, you could leave all groups and join only the ones provided.
Changes become active not immediately but when the server executes this operation (approximately RTT/2).
Groups to remove from interest. Null will not remove any. A byte[0] will remove all.
Groups to add to interest. Null will not add any. A byte[0] will add all current.
If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
Privately used to read-out properties coming from the server in events and operation responses (which might be a bit tricky).
Privately used only to read properties for a distinct actor (which might be the hashtable OR a key-pair value IN the actorProperties).
Internally used to set the LocalPlayer's ID (from -1 to the actual in-room ID).
New actor ID (a.k.a actorNr) assigned when joining a room.
Called internally, when a game was joined or created on the game server successfully.
This reads the response, finds out the local player's actorNumber (a.k.a. Player.ID) and applies properties of the room and players.
Errors for these operations are to be handled before this method is called.
Contains the server's response for an operation called by this peer.
Factory method to create a player instance - override to get your own player-type with custom features.
The name of the player to be created.
The player ID (a.k.a. actorNumber) of the player to be created.
Sets the distinction if the player to be created is your player or if its assigned to someone else.
The custom properties for this new player
The newly created player
Internal "factory" method to create a room-instance.
Debug output of low level api (and this client).
This method is not responsible to keep up the state of a LoadBalancingClient. Calling base.DebugReturn on overrides is optional.
Uses the OperationResponses provided by the server to advance the internal state and call ops as needed.
When this method finishes, it will call your OnOpResponseAction (if any). This way, you can get any
operation response without overriding this class.
To implement a more complex game/app logic, you should implement your own class that inherits the
LoadBalancingClient. Override this method to use your own operation-responses easily.
This method is essential to update the internal state of a LoadBalancingClient, so overriding methods
must call base.OnOperationResponse().
Contains the server's response for an operation called by this peer.
Uses the connection's statusCodes to advance the internal state and call operations as needed.
This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnStatusChanged.
Uses the photonEvent's provided by the server to advance the internal state and call ops as needed.
This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnEvent.
In Photon 4, "raw messages" will get their own callback method in the interface. Not used yet.
A callback of the RegionHandler, provided in OnRegionListReceived.
The regionHandler wraps up best region and other region relevant info.
This operation makes Photon call your custom web-service by path/name with the given parameters (converted into Json).
Use as a callback.
A WebRPC calls a custom, http-based function on a server you provide. The uriPath is relative to a "base path"
which is configured server-side. The sent parameters get converted from C# types to Json. Vice versa, the response
of the web-service will be converted to C# types and sent back as normal operation response.
To use this feature, you have to setup your server:
For a Photon Cloud application,
visit the Dashboard and setup "WebHooks". The BaseUrl is used for WebRPCs as well.
The class is a helper-class that extracts the most valuable content from the WebRPC
response.
The url path to call, relative to the baseUrl configured on Photon's server-side.
The parameters to send to the web-service method.
Defines if the authentication cookie gets sent to a WebHook (if setup).
Registers an object for callbacks for the implemented callback-interfaces.
Adding and removing callback targets is queued to not mess with callbacks in execution.
Internally, this means that the addition/removal is done before the LoadBalancingClient
calls the next callbacks. This detail should not affect a game's workflow.
The covered callback interfaces are: IConnectionCallbacks, IMatchmakingCallbacks,
ILobbyCallbacks, IInRoomCallbacks, IOnEventCallback and IWebRpcCallback.
See: DotNet Callbacks
The object that registers to get callbacks from this client.
Unregisters an object from callbacks for the implemented callback-interfaces.
Adding and removing callback targets is queued to not mess with callbacks in execution.
Internally, this means that the addition/removal is done before the LoadBalancingClient
calls the next callbacks. This detail should not affect a game's workflow.
The covered callback interfaces are: IConnectionCallbacks, IMatchmakingCallbacks,
ILobbyCallbacks, IInRoomCallbacks, IOnEventCallback and IWebRpcCallback.
See:
The object that unregisters from getting callbacks.
Applies queued callback cahnges from a queue to the actual containers. Will cause exceptions if used while callbacks execute.
There is no explicit check that this is not called during callbacks, however the implemented, private logic takes care of this.
Helper method to cast and apply a target per (interface) type.
Either of the interfaces for callbacks.
The queued change to apply (add or remove) some target.
The container that calls callbacks on it's list of targets.
Collection of "organizational" callbacks for the Realtime Api to cover: Connection and Regions.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
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.
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.
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.
Called when the Name Server provided a list of regions for your title.
This callback is called as soon as the list is available. No pings were sent for Best Region selection yet.
If the client is set to connect to the Best Region (lowest ping), one or more regions get pinged.
Not all regions are pinged. As soon as the results are final, the client will connect to the best region,
so you can check the ping results when connected to the Master Server.
Check the RegionHandler class description, to make use of the provided values.
The currently used RegionHandler.
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) { ... }
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](https://dashboard.photonengine.com)),
this won't be called!
Contains a debug message why authentication failed. This has to be fixed during development.
Collection of "organizational" callbacks for the Realtime Api to cover the Lobby.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
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.
Called after leaving a lobby.
When you leave a lobby, [OpCreateRoom](@ref OpCreateRoom) and [OpJoinRandomRoom](@ref OpJoinRandomRoom)
automatically refer to the default lobby.
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.
The list is sorted using two criteria: open or closed, full or not. So the list is composed of three groups, in this order:
first group: open and not full (joinable).
second group: full but not closed (not joinable).
third group: closed (not joinable, could be full or not).
In each group, entries do not have any particular order (random).
The list of rooms (or rooms' updates) is also limited in number, see Lobby Limits.
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.
Collection of "organizational" callbacks for the Realtime Api to cover Matchmaking.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
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.
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.
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.
Operation ReturnCode from the server.
Debug message for the error.
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).
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.
Operation ReturnCode from the server.
Debug message for the error.
Called when a previous OpJoinRandom (or OpJoinRandomOrCreateRoom etc.) 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.
Operation ReturnCode from the server.
Debug message for the error.
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.
OnLeftRoom also gets called, when the application quits.
It makes sense to check static ConnectionHandler.AppQuits before loading scenes in OnLeftRoom().
Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
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.
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.
Called when room properties changed. The propertiesThatChanged contain only the keys that changed.
In most cases, this method gets called when some player changes the Room Properties.
However, there are also "Well Known Properties" (which use byte keys) and this callback may include them.
Especially when entering a room, the server will also send the required Well Known Properties and they
are not filtered out for the OnRoomPropertiesUpdate callback.
You can safely ignore the byte typed keys in propertiesThatChanged.
Changing properties is usually done by Room.SetCustomProperties.
Called when custom player-properties are changed.
Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too.
Contains Player that changed.
Contains the properties that changed.
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.
Event callback for the Realtime Api. Covers events from the server and those sent by clients via OpRaiseEvent.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
Called for any incoming events.
To receive events, implement IOnEventCallback in any class and register it via AddCallbackTarget
(either in LoadBalancingClient or PhotonNetwork).
With the EventData.Sender you can look up the Player who sent the event.
It is best practice to assign an eventCode for each different type of content and action, so the Code
will be essential to read the incoming events.
Interface for "WebRpc" callbacks for the Realtime Api. Currently includes only responses for Web RPCs.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
Called when the response to a WebRPC is available. See .
Important: The response.ReturnCode is 0 if Photon was able to reach your web-service.
The content of the response is what your web-service sent. You can create a WebRpcResponse from it.
Example: WebRpcResponse webResponse = new WebRpcResponse(operationResponse);
Please note: Class OperationResponse is in a namespace which needs to be "used":
using ExitGames.Client.Photon; // includes OperationResponse (and other classes)
public void OnWebRpcResponse(OperationResponse response)
{
Debug.LogFormat("WebRPC operation response {0}", response.ToStringFull());
switch (response.ReturnCode)
{
case ErrorCode.Ok:
WebRpcResponse webRpcResponse = new WebRpcResponse(response);
Debug.LogFormat("Parsed WebRPC response {0}", response.ToStringFull());
if (string.IsNullOrEmpty(webRpcResponse.Name))
{
Debug.LogError("Unexpected: WebRPC response did not contain WebRPC method name");
}
if (webRpcResponse.ResultCode == 0) // success
{
switch (webRpcResponse.Name)
{
// todo: add your code here
case GetGameListWebRpcMethodName: // example
// ...
break;
}
}
else if (webRpcResponse.ResultCode == -1)
{
Debug.LogErrorFormat("Web server did not return ResultCode for WebRPC method=\"{0}\", Message={1}", webRpcResponse.Name, webRpcResponse.Message);
}
else
{
Debug.LogErrorFormat("Web server returned ResultCode={0} for WebRPC method=\"{1}\", Message={2}", webRpcResponse.ResultCode, webRpcResponse.Name, webRpcResponse.Message);
}
break;
case ErrorCode.ExternalHttpCallFailed: // web service unreachable
Debug.LogErrorFormat("WebRPC call failed as request could not be sent to the server. {0}", response.DebugMessage);
break;
case ErrorCode.HttpLimitReached: // too many WebRPCs in a short period of time
// the debug message should contain the limit exceeded
Debug.LogErrorFormat("WebRPCs rate limit exceeded: {0}", response.DebugMessage);
break;
case ErrorCode.InvalidOperation: // WebRPC not configured at all OR not configured properly OR trying to send on name server
if (PhotonNetwork.Server == ServerConnection.NameServer)
{
Debug.LogErrorFormat("WebRPC not supported on NameServer. {0}", response.DebugMessage);
}
else
{
Debug.LogErrorFormat("WebRPC not properly configured or not configured at all. {0}", response.DebugMessage);
}
break;
default:
// other unknown error, unexpected
Debug.LogErrorFormat("Unexpected error, {0} {1}", response.ReturnCode, response.DebugMessage);
break;
}
}
Interface for event callback for the Realtime Api.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call and pass the class implementing this interface
To stop getting callbacks, call and pass the class implementing this interface
\ingroup callbacks
Called when the client receives an event from the server indicating that an error happened there.
In most cases this could be either:
1. an error from webhooks plugin (if HasErrorInfo is enabled), read more here:
https://doc.photonengine.com/en-us/realtime/current/gameplay/web-extensions/webhooks#options
2. an error sent from a custom server plugin via PluginHost.BroadcastErrorInfoEvent, see example here:
https://doc.photonengine.com/en-us/server/current/plugins/manual#handling_http_response
3. an error sent from the server, for example, when the limit of cached events has been exceeded in the room
(all clients will be disconnected and the room will be closed in this case)
read more here: https://doc.photonengine.com/en-us/realtime/current/gameplay/cached-events#special_considerations
If you implement or you will also get this event.
Object containing information about the error
Container type for callbacks defined by IConnectionCallbacks. See LoadBalancingCallbackTargets.
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Container type for callbacks defined by IMatchmakingCallbacks. See MatchMakingCallbackTargets.
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Container type for callbacks defined by IInRoomCallbacks. See InRoomCallbackTargets.
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Container type for callbacks defined by ILobbyCallbacks. See LobbyCallbackTargets.
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Container type for callbacks defined by IWebRpcCallback. See WebRpcCallbackTargets.
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Container type for callbacks defined by . See .
While the interfaces of callbacks wrap up the methods that will be called,
the container classes implement a simple way to call a method on all registered objects.
Class wrapping the received event.
This is passed inside callback.
If you implement or you will also get but not parsed.
In most cases this could be either:
1. an error from webhooks plugin (if HasErrorInfo is enabled), read more here:
https://doc.photonengine.com/en-us/realtime/current/gameplay/web-extensions/webhooks#options
2. an error sent from a custom server plugin via PluginHost.BroadcastErrorInfoEvent, see example here:
https://doc.photonengine.com/en-us/server/current/plugins/manual#handling_http_response
3. an error sent from the server, for example, when the limit of cached events has been exceeded in the room
(all clients will be disconnected and the room will be closed in this case)
read more here: https://doc.photonengine.com/en-us/realtime/current/gameplay/cached-events#special_considerations
String containing information about the error.
A LoadBalancingPeer provides the operations and enum definitions needed to use the LoadBalancing server application which is also used in Photon Cloud.
This class is internally used.
The LoadBalancingPeer does not keep a state, instead this is done by a LoadBalancingClient.
Obsolete accessor to the RegionHandler.PingImplementation.
Creates a Peer with specified connection protocol. You need to set the Listener before using the peer.
Each connection protocol has it's own default networking ports for Photon.
The preferred option is UDP.
Creates a Peer with specified connection protocol and a Listener for callbacks.
Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms.
This is an async request which triggers a OnOperationResponse() call.
The lobby join to.
If the operation could be sent (has to be connected).
Leaves the lobby on the Master Server.
This is an async request which triggers a OnOperationResponse() call.
If the operation could be sent (requires connection).
Used by OpJoinRoom and by OpCreateRoom alike.
Creates a room (on either Master or Game Server).
The OperationResponse depends on the server the peer is connected to:
Master will return a Game Server to connect to.
Game Server will return the joined Room's data.
This is an async request which triggers a OnOperationResponse() call.
If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.
Joins a room by name or creates new room if room with given name not exists.
The OperationResponse depends on the server the peer is connected to:
Master will return a Game Server to connect to.
Game Server will return the joined Room's data.
This is an async request which triggers a OnOperationResponse() call.
If the room is not existing (anymore), the OperationResponse will have a returnCode of ErrorCode.GameDoesNotExist.
Other possible ErrorCodes are: GameClosed, GameFull.
If the operation could be sent (requires connection).
Operation to join a random, available room. Overloads take additional player properties.
This is an async request which triggers a OnOperationResponse() call.
If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound.
If successful, the OperationResponse contains a gameserver address and the name of some room.
If the operation could be sent currently (requires connection).
Only used on the Master Server. It will assign a game server and room to join-or-create.
On the Game Server, the OpJoin is used with option "create if not exists".
Leaves a room with option to come back later or "for good".
Async games can be re-joined (loaded) later on. Set to false, if you want to abandon a game entirely.
WebFlag: Securely transmit the encrypted object AuthCookie to the web service in PathLeave webhook when available
If the opteration can be send currently.
Gets a list of games matching a SQL-like where clause.
Operation is only available in lobbies of type SqlLobby.
This is an async request which triggers a OnOperationResponse() call.
Returned game list is stored in RoomInfoList.
The lobby to query. Has to be of type SqlLobby.
The sql query statement.
If the operation could be sent (has to be connected).
Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate).
Used on Master Server to find the rooms played by a selected list of users.
Users identify themselves by using OpAuthenticate with a unique user ID.
The list of user IDs must be fetched from some other source (not provided by Photon).
The server response includes 2 arrays of info (each index matching a friend from the request):
ParameterCode.FindFriendsResponseOnlineList = bool[] of online states
ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
The options may be used to define which state a room must match to be returned.
Array of friend's names (make sure they are unique).
Options that affect the result of the FindFriends operation.
If the operation could be sent (requires connection).
Sets properties of a player / actor.
Internally this uses OpSetProperties, which can be used to either set room or player properties.
The payer ID (a.k.a. actorNumber) of the player to attach these properties to.
The properties to add or update.
If set, these must be in the current properties-set (on the server) to set actorProperties: CAS.
Set these to forward the properties to a WebHook as defined for this app (in Dashboard).
If the operation could be sent (requires connection).
Sets properties of a room.
Internally this uses OpSetProperties, which can be used to either set room or player properties.
The properties to add or update.
The properties expected when update occurs. (CAS : "Check And Swap")
WebFlag to indicate if request should be forwarded as "PathProperties" webhook or not.
If the operation could be sent (has to be connected).
Sends this app's appId and appVersion to identify this application server side.
This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before.
See: EstablishEncryption(). Check encryption with IsEncryptionAvailable.
This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
The client's version (clients with differing client appVersions are separated and players don't meet).
Contains all values relevant for authentication. Even without account system (external Custom Auth), the clients are allowed to identify themselves.
Optional region code, if the client should connect to a specific Photon Cloud Region.
Set to true on Master Server to receive "Lobby Statistics" events.
If the operation could be sent (has to be connected).
Sends this app's appId and appVersion to identify this application server side.
This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before.
See: EstablishEncryption(). Check encryption with IsEncryptionAvailable.
This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
The client's version (clients with differing client appVersions are separated and players don't meet).
Optional authentication values. The client can set no values or a UserId or some parameters for Custom Authentication by a server.
Optional region code, if the client should connect to a specific Photon Cloud Region.
If the operation could be sent (has to be connected).
Operation to handle this client's interest groups (for events in room).
Note the difference between passing null and byte[0]:
null won't add/remove any groups.
byte[0] will add/remove all (existing) groups.
First, removing groups is executed. This way, you could leave all groups and join only the ones provided.
Changes become active not immediately but when the server executes this operation (approximately RTT/2).
Groups to remove from interest. Null will not remove any. A byte[0] will remove all.
Groups to add to interest. Null will not add any. A byte[0] will add all current.
If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
Send an event with custom code/type and any content to the other players in the same room.
This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.
Identifies this type of event (and the content). Your game's event codes can start with 0.
Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
Contains (slightly) less often used options. If you pass null, the default options will be used.
Send options for reliable, encryption etc
If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
Internally used operation to set some "per server" settings. This is for the Master Server.
Set to true, to get Lobby Statistics (lists of existing lobbies).
False if the operation could not be sent.
Used in the RoomOptionFlags parameter, this bitmask toggles options in the room.
Options for OpFindFriends can be combined to filter which rooms of friends are returned.
Include a friend's room only if it is created and confirmed by the game server.
Include a friend's room only if it is visible (using Room.IsVisible).
Include a friend's room only if it is open (using Room.IsOpen).
Turns the bool options into an integer, which is sent as option flags for Op FindFriends.
The options applied to bits of an integer.
Parameters for the matchmaking of JoinRandomRoom and JoinRandomOrCreateRoom.
More about matchmaking: .
The custom room properties a room must have to fit. All key-values must be present to match. In SQL Lobby, use SqlLobbyFilter instead.
Filters by the MaxPlayers value of rooms.
The MatchmakingMode affects how rooms get filled. By default, the server fills rooms.
The lobby in which to match. The type affects how filters are applied.
SQL query to filter room matches. For default-typed lobbies, use ExpectedCustomRoomProperties instead.
The expected users list blocks player slots for your friends or team mates to join the room, too.
See: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby#matchmaking_slot_reservation
Ticket for matchmaking. Provided by a plugin / server and contains a list of party members who should join the same room (among other things).
Parameters for creating rooms.
The name of the room to create. If null, the server generates a unique name. If not null, it must be unique and new or will cause an error.
The RoomOptions define the optional behaviour of rooms.
A lobby to attach the new room to. If set, this overrides a joined lobby (if any).
The custom player properties that describe this client / user. Keys must be strings.
Internally used value to skip some values when the operation is sent to the Master Server.
Internally used value to check which join mode we should call.
A list of users who are expected to join the room along with this client. Reserves slots for rooms with MaxPlayers value.
Ticket for matchmaking. Provided by a plugin / server and contains a list of party members who should join the same room (among other things).
ErrorCode defines the default codes associated with Photon client/server communication.
(0) is always "OK", anything else an error or specific situation.
(-3) Operation can't be executed yet (e.g. OpJoin can't be called before being authenticated, RaiseEvent cant be used before getting into a room).
Before you call any operations on the Cloud servers, the automated client workflow must complete its authorization.
Wait until State is: JoinedLobby or ConnectedToMasterServer
(-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.
(-2) The operation you called could not be executed on the server.
Make sure you are connected to the server you expect.
This code is used in several cases:
The arguments/parameters of the operation might be out of range, missing entirely or conflicting.
The operation you called is not implemented on the server (application). Server-side plugins affect the available operations.
(-1) Something went wrong in the server. Try to reproduce and contact Exit Games.
(32767) Authentication failed. Possible cause: AppId is unknown to Photon (in cloud service).
(32766) GameId (name) already in use (can't create another). Change name.
(32765) Game is full. This rarely happens when some player joined the room before your join completed.
(32764) Game is closed and can't be joined. Join another game.
(32762) All servers are busy. This is a temporary issue and the game logic should try again after a brief wait time.
This error may happen for all operations that create rooms. The operation response will contain this error code.
This error is very unlikely to happen as we monitor load on all servers and add them on demand.
However, it's good to be prepared for a shortage of machines or surge in CCUs.
(32761) Not in use currently.
(32760) Random matchmaking only succeeds if a room exists thats neither closed nor full. Repeat in a few seconds or create a new room.
(32758) Join can fail if the room (name) is not existing (anymore). This can happen when players leave while you join.
(32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.
Unless you have a plan with "CCU Burst", clients might fail the authentication step during connect.
Affected client are unable to call operations. Please note that players who end a game and return
to the master server will disconnect and re-connect, which means that they just played and are rejected
in the next minute / re-connect.
This is a temporary measure. Once the CCU is below the limit, players will be able to connect an play again.
OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
(32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.
Some subscription plans for the Photon Cloud are region-bound. Servers of other regions can't be used then.
Check your master server address and compare it with your Photon Cloud Dashboard's info.
https://dashboard.photonengine.com
OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
(32755) Custom Authentication of the user failed due to setup reasons (see Cloud Dashboard) or the provided user data (like username or token). Check error message for details.
(32753) The Authentication ticket expired. Usually, this is refreshed behind the scenes. Connect (and authorize) again.
(32752) A server-side plugin or WebHook failed and reported an error. Check the OperationResponse.DebugMessage.
A typical case is when a plugin prevents a user from creating or joining a room.
If this is prohibited, that reports to the client as a plugin error.
Same for WebHooks.
(32751) CreateGame/JoinGame/Join operation fails if expected plugin does not correspond to loaded one.
(32750) for join requests. Indicates the current peer already called join and is joined to the room.
(32749) for join requests. Indicates the list of InactiveActors already contains an actor with the requested ActorNr or UserId.
(32748) for join requests. Indicates the list of Actors (active and inactive) did not contain an actor with the requested ActorNr or UserId.
(32747) for join requests. Note: for future use - Indicates the requested UserId was found in the ExcludedList.
(32746) for join requests. Indicates the list of ActiveActors already contains an actor with the requested ActorNr or UserId.
(32745) for SetProperties and RaiseEvent (if flag HttpForward is true) requests. Indicates the maximum allowed http requests per minute was reached.
(32744) for WebRpc requests. Indicates the the call to the external service failed.
(32743) for operations with defined limits (as in calls per second, content count or size).
(32742) Server error during matchmaking with slot reservation. E.g. the reserved slots can not exceed MaxPlayers.
(32741) Server will react with this error if invalid encryption parameters provided by token
Class for constants. These (byte) values define "well known" properties for an Actor / Player.
These constants are used internally.
"Custom properties" have to use a string-type as key. They can be assigned at will.
(255) Name of a player/actor.
(254) Tells you if the player is currently in this game (getting events live).
A server-set value for async games, where players can leave the game and return later.
(253) UserId of the player. Sent when room gets created with RoomOptions.PublishUserId = true.
Class for constants. These (byte) values are for "well known" room/game properties used in Photon LoadBalancing.
These constants are used internally.
"Custom properties" have to use a string-type as key. They can be assigned at will.
(255) Max number of players that "fit" into this room. 0 is for "unlimited".
(243) Integer-typed max number of players that "fit" into a room. 0 is for "unlimited". Important: Code changed. See remarks.
This was code 244 for a brief time (Realtime v4.1.7.2 to v4.1.7.4) and those versions must be replaced or edited!
(254) Makes this room listed or not in the lobby on master.
(253) Allows more players to join a room (or not).
(252) Current count of players in the room. Used only in the lobby on master.
(251) True if the room is to be removed from room listing (used in update to room list in lobby on master)
(250) A list of the room properties to pass to the RoomInfo list in a lobby. This is used in CreateRoom, which defines this list once per room.
(249) Equivalent of Operation Join parameter CleanupCacheOnLeave.
(248) Code for MasterClientId, which is synced by server. When sent as op-parameter this is (byte)203. As room property this is (byte)248.
Tightly related to ParameterCode.MasterClientId.
(247) Code for ExpectedUsers in a room. Matchmaking keeps a slot open for the players with these userIDs.
(246) Player Time To Live. How long any player can be inactive (due to disconnect or leave) before the user gets removed from the playerlist (freeing a slot).
(245) Room Time To Live. How long a room stays available (and in server-memory), after the last player becomes inactive. After this time, the room gets persisted or destroyed.
Class for constants. These values are for events defined by Photon LoadBalancing.
They start at 255 and go DOWN. Your own in-game events can start at 0. These constants are used internally.
(230) Initial list of RoomInfos (in lobby on Master)
(229) Update of RoomInfos to be merged into "initial" list (in lobby on Master)
(228) Currently not used. State of queueing in case of server-full
(227) Currently not used. Event for matchmaking
(226) Event with stats about this application (players, rooms, etc)
(224) This event provides a list of lobbies with their player and game counts.
(210) Internally used in case of hosting by Azure
(255) Event Join: someone joined the game. The new actorNumber is provided as well as the properties of that actor (if set in OpJoin).
(254) Event Leave: The player who left the game can be identified by the actorNumber.
(253) When you call OpSetProperties with the broadcast option "on", this event is fired. It contains the properties being set.
(253) When you call OpSetProperties with the broadcast option "on", this event is fired. It contains the properties being set.
(252) When player left game unexpected and the room has a playerTtl != 0, this event is fired to let everyone know about the timeout.
Obsolete. Replaced by Leave. public const byte Disconnect = LiteEventCode.Disconnect;
(251) Sent by Photon Cloud when a plugin-call or webhook-call failed or events cache limit exceeded. Usually, the execution on the server continues, despite the issue. Contains: ParameterCode.Info.
(250) Sent by Photon whent he event cache slice was changed. Done by OpRaiseEvent.
(223) Sent by Photon to update a token before it times out.
Class for constants. Codes for parameters of Operations and Events.
These constants are used internally.
(237) A bool parameter for creating games. If set to true, no room events are sent to the clients on join and leave. Default: false (and not sent).
(236) Time To Live (TTL) for a room when the last player leaves. Keeps room in memory for case a player re-joins soon. In milliseconds.
(235) Time To Live (TTL) for an 'actor' in a room. If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds.
(234) Optional parameter of OpRaiseEvent and OpSetCustomProperties to forward the event/operation to a web-service.
(233) Optional parameter of OpLeave in async games. If false, the player does abandons the game (forever). By default players become inactive and can re-join.
(233) Used in EvLeave to describe if a user is inactive (and might come back) or not. In rooms with PlayerTTL, becoming inactive is the default case.
(232) Used when creating rooms to define if any userid can join the room only once.
(231) Code for "Check And Swap" (CAS) when changing properties.
(230) Address of a (game) server to use.
(229) Count of players in this application in a rooms (used in stats event)
(228) Count of games in this application (used in stats event)
(227) Count of players on the master server (in this app, looking for rooms)
(225) User's ID
(224) Your application's ID: a name on your own Photon or a GUID on the Photon Cloud
(223) Not used currently (as "Position"). If you get queued before connect, this is your position
(223) Modifies the matchmaking algorithm used for OpJoinRandom. Allowed parameter values are defined in enum MatchmakingMode.
(222) List of RoomInfos about open / listed rooms
(221) Internally used to establish encryption
(220) Version of your application
(210) Internally used in case of hosting by Azure
(209) Internally used in case of hosting by Azure
(208) Internally used in case of hosting by Azure
(255) Code for the gameId/roomName (a unique name per room). Used in OpJoin and similar.
(250) Code for broadcast parameter of OpSetProperties method.
(252) Code for list of players in a room.
(254) Code of the Actor of an operation. Used for property get and set.
(249) Code for property set (Hashtable).
(245) Code of data/custom content of an event. Used in OpRaiseEvent.
(245) Code of data of an event. Used in OpRaiseEvent.
(244) Code used when sending some code-related parameter, like OpRaiseEvent's event-code.
This is not the same as the Operation's code, which is no longer sent as part of the parameter Dictionary in Photon 3.
(248) Code for property set (Hashtable).
(251) Code for property-set (Hashtable). This key is used when sending only one set of properties.
If either ActorProperties or GameProperties are used (or both), check those keys.
(253) Code of the target Actor of an operation. Used for property set. Is 0 for game
(246) Code to select the receivers of events (used in Lite, Operation RaiseEvent).
(247) Code for caching events while raising them.
(241) Bool parameter of CreateGame Operation. If true, server cleans up roomcache of leaving players (their cached events get removed).
(240) Code for "group" operation-parameter (as used in Op RaiseEvent).
(239) The "Remove" operation-parameter can be used to remove something from a list. E.g. remove groups from player's interest groups.
(239) Used in Op Join to define if UserIds of the players are broadcast in the room. Useful for FindFriends and reserving slots for expected users.
(238) The "Add" operation-parameter can be used to add something to some list or set. E.g. add groups to player's interest groups.
(218) Content for EventCode.ErrorInfo and internal debug operations.
(217) This key's (byte) value defines the target custom authentication type/service the client connects with. Used in OpAuthenticate
(216) This key's (string) value provides parameters sent to the custom authentication type/service the client connects with. Used in OpAuthenticate
(215) The JoinMode enum defines which variant of joining a room will be executed: Join only if available, create if not exists or re-join.
Replaces CreateIfNotExists which was only a bool-value.
(214) This key's (string or byte[]) value provides parameters sent to the custom authentication service setup in Photon Dashboard. Used in OpAuthenticate
(203) Code for MasterClientId, which is synced by server. When sent as op-parameter this is code 203.
Tightly related to GamePropertyKey.MasterClientId.
(1) Used in Op FindFriends request. Value must be string[] of friends to look up.
(2) Used in Op FindFriends request. An integer containing option-flags to filter the results.
(1) Used in Op FindFriends response. Contains bool[] list of online states (false if not online).
(2) Used in Op FindFriends response. Contains string[] of room names ("" where not known or no room joined).
(213) Used in matchmaking-related methods and when creating a room to name a lobby (to join or to attach a room to).
(212) Used in matchmaking-related methods and when creating a room to define the type of a lobby. Combined with the lobby name this identifies the lobby.
(211) This (optional) parameter can be sent in Op Authenticate to turn on Lobby Stats (info about lobby names and their user- and game-counts).
(210) Used for region values in OpAuth and OpGetRegions.
(209) Path of the WebRPC that got called. Also known as "WebRpc Name". Type: string.
(208) Parameters for a WebRPC as: Dictionary<string, object>. This will get serialized to JSon.
(207) ReturnCode for the WebRPC, as sent by the web service (not by Photon, which uses ErrorCode). Type: byte.
(206) Message returned by WebRPC server. Analog to Photon's debug message. Type: string.
(205) Used to define a "slice" for cached events. Slices can easily be removed from cache. Type: int.
(204) Informs the server of the expected plugin setup.
The operation will fail in case of a plugin mismatch returning error code PluginMismatch 32751(0x7FFF - 16).
Setting string[]{} means the client expects no plugin to be setup.
Note: for backwards compatibility null omits any check.
(202) Used by the server in Operation Responses, when it sends the nickname of the client (the user's nickname).
(201) Informs user about name of plugin load to game
(200) Informs user about version of plugin load to game
(196) Cluster info provided in OpAuthenticate/OpAuthenticateOnce responses.
(195) Protocol which will be used by client to connect master/game servers. Used for nameserver.
(194) Set of custom parameters which are sent in auth request.
(193) How are we going to encrypt data.
(192) Parameter of Authentication, which contains encryption keys (depends on AuthMode and EncryptionMode).
(191) An int parameter summarizing several boolean room-options with bit-flags.
Matchmaking ticket (type object).
Used server side once the group is extracted from the ticket. Clients don't send this.
(188) Parameter key to let the server know it may queue the client in low-ccu matchmaking situations.
Class for constants. Contains operation codes.
These constants are used internally.
(255) Code for OpJoin, to get into a room.
(231) Authenticates this peer and connects to a virtual application
(230) Authenticates this peer and connects to a virtual application
(229) Joins lobby (on master)
(228) Leaves lobby (on master)
(227) Creates a game (or fails if name exists)
(226) Join game (by name)
(225) Joins random game (on master)
(254) Code for OpLeave, to get out of a room.
(253) Raise event (in a room, for other actors/players)
(252) Set Properties (of room or actor/player)
(251) Get Properties
(248) Operation code to change interest groups in Rooms (Lite application and extending ones).
(222) Request the rooms and online status for a list of friends (by name, which should be unique).
(221) Request statistics about a specific list of lobbies (their user and game count).
(220) Get list of regional servers from a NameServer.
(219) WebRpc Operation.
(218) Operation to set some server settings. Used with different parameters on various servers.
(217) Get the game list matching a supplied sql filter (SqlListLobby only)
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.
Regular join. The room must exist.
Join or create the room if it's not existing. Used for OpJoinOrCreate for example.
The room might be out of memory and should be loaded (if possible) from a Turnbased web-service.
Only re-join will be allowed. If the user is not yet in the room, this will fail.
Options for matchmaking rules for OpJoinRandom.
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.
Distributes players across available rooms sequentially but takes filter into account. Without filter, rooms get players evenly distributed.
Joins a (fully) random room. Expected properties must match but aside from this, any available room might be selected.
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.
Default value (not sent). Anyone else gets my event.
Everyone in the current room (including this peer) will get this event.
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.
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.
Default value (not sent).
Will merge this event's keys with those already cached.
Replaces the event cache for this eventCode with this event's content.
Removes this event (by eventCode) from the cache.
Adds an event to the room's cache
Adds this event to the cache for actor 0 (becoming a "globally owned" event in the cache).
Remove fitting event from the room's cache.
Removes events of players who already left the room (cleaning up).
Increase the index of the sliced cache.
Set the index of the sliced cache. You must set RaiseEventOptions.CacheSliceIndex for this.
Purge cache slice with index. Exactly one slice is removed from cache. You must set RaiseEventOptions.CacheSliceIndex for this.
Purge cache slices with specified index and anything lower than that. You must set RaiseEventOptions.CacheSliceIndex for this.
Flags for "types of properties", being used as filter in OpGetProperties.
(0x00) Flag type for no property type.
(0x01) Flag type for game-attached properties.
(0x02) Flag type for actor related propeties.
(0x01) Flag type for game AND actor properties. Equal to 'Game'
Wraps up common room properties needed when you create rooms. Read the individual entries for more details.
This directly maps to the fields in the Room class.
Defines if this room is listed in the lobby. If not, it also is not joined randomly.
A room that is not visible will be excluded from the room lists that are sent to the clients in lobbies.
An invisible room can be joined by name but is excluded from random matchmaking.
Use this to "hide" a room and simulate "private rooms". Players can exchange a roomname and create it
invisble to avoid anyone else joining it.
Defines if this room can be joined at all.
If a room is closed, no player can join this. As example this makes sense when 3 of 4 possible players
start their gameplay early and don't want anyone to join during the game.
The room can still be listed in the lobby (set isVisible to control lobby-visibility).
Max number of players that can be in the room at any time. 0 means "no limit".
Time To Live (TTL) for an 'actor' in a room. If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds.
Time To Live (TTL) for a room when the last player leaves. Keeps room in memory for case a player re-joins soon. In milliseconds.
Removes a user's events and properties from the room when a user leaves.
This makes sense when in rooms where players can't place items in the room and just vanish entirely.
When you disable this, the event history can become too long to load if the room stays in use indefinitely.
Default: true. Cleans up the cache and props of leaving users.
The room's custom properties to set. Use string keys!
Custom room properties are any key-values you need to define the game's setup.
The shorter your keys are, the better.
Example: Map, Mode (could be "m" when used with "Map"), TileSet (could be "t").
Defines the custom room properties that get listed in the lobby.
Name the custom room properties that should be available to clients that are in a lobby.
Use with care. Unless a custom property is essential for matchmaking or user info, it should
not be sent to the lobby, which causes traffic and delays for clients in the lobby.
Default: No custom properties are sent to the lobby.
Informs the server of the expected plugin setup.
The operation will fail in case of a plugin missmatch returning error code PluginMismatch 32757(0x7FFF - 10).
Setting string[]{} means the client expects no plugin to be setup.
Note: for backwards compatibility null omits any check.
Tells the server to skip room events for joining and leaving players.
Using this makes the client unaware of the other players in a room.
That can save some traffic if you have some server logic that updates players
but it can also limit the client's usability.
Disables events join and leave from the server as well as property broadcasts in a room (to minimize traffic)
Defines if the UserIds of players get "published" in the room. Useful for FindFriends, if players want to play another game together.
When you set this to true, Photon will publish the UserIds of the players in that room.
In that case, you can use PhotonPlayer.userId, to access any player's userID.
This is useful for FindFriends and to set "expected users" to reserve slots in a room.
Optionally, properties get deleted, when null gets assigned as value. Defaults to off / false.
When Op SetProperties is setting a key's value to null, the server and clients should remove the key/value from the Custom Properties.
By default, the server keeps the keys (and null values) and sends them to joining players.
Important: Only when SetProperties does a "broadcast", the change (key, value = null) is sent to clients to update accordingly.
This applies to Custom Properties for rooms and actors/players.
By default, property changes are sent back to the client that's setting them to avoid de-sync when properties are set concurrently.
This option is enables by default to fix this scenario:
1) On server, room property ABC is set to value FOO, which triggers notifications to all the clients telling them that the property changed.
2) While that notification is in flight, a client sets the ABC property to value BAR.
3) Client receives notification from the server and changes it�s local copy of ABC to FOO.
4) Server receives the set operation and changes the official value of ABC to BAR, but never notifies the client that sent the set operation that the value is now BAR.
Without this option, the client that set the value to BAR never hears from the server that the official copy has been updated to BAR, and thus gets stuck with a value of FOO.
Aggregates several less-often used options for operation RaiseEvent. See field descriptions for usage details.
Default options: CachingOption: DoNotCache, InterestGroup: 0, targetActors: null, receivers: Others, sequenceChannel: 0.
Defines if the server should simply send the event, put it in the cache or remove events that are like this one.
When using option: SliceSetIndex, SlicePurgeIndex or SlicePurgeUpToIndex, set a CacheSliceIndex. All other options except SequenceChannel get ignored.
The number of the Interest Group to send this to. 0 goes to all users but to get 1 and up, clients must subscribe to the group first.
A list of Player.ActorNumbers to send this event to. You can implement events that just go to specific users this way.
Sends the event to All, MasterClient or Others (default). Be careful with MasterClient, as the client might disconnect before it got the event and it gets lost.
Events are ordered per "channel". If you have events that are independent of others, they can go into another sequence or channel.
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.
Types of lobbies define their behaviour and capabilities. Check each value for details.
Values of this enum must be matched by the server.
Standard type and behaviour: While joined to this lobby clients get room-lists and JoinRandomRoom can use a simple filter to match properties (perfectly).
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.
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.
Refers to a specific lobby on the server.
Name and Type combined are the unique identifier for a lobby.
The server will create lobbies "on demand", so no registration or setup is required.
An empty or null Name always points to the "default lobby" as special case.
Name of the lobby. Default: null, pointing to the "default lobby".
If Name is null or empty, a TypedLobby will point to the "default lobby". This ignores the Type value and always acts as .
Type (and behaviour) of the lobby.
An empty or null Name always points to the "default lobby" as special case.
A reference to the default lobby which is the unique lobby that uses null as name and is of type .
There is only a single lobby with an empty name on the server. It is always of type .
On the other hand, this is a shortcut and reusable reference to the default lobby.
Do not change Name or Type.
Returns whether or not this instance points to the "default lobby" ().
This comes up to checking if the Name is null or empty.
is not the same thing as the "default lobby" ().
Creates a TypedLobby instance. Unless Name is changed, this points to the "default lobby" ().
Sets Name and Type of the new instance. Make sure name is not empty or null, as that always points to the "default lobby" ().
Some string to identify a lobby.
The type of a lobby defines it's capabilities and behaviour.
Info for a lobby on the server. Used when is true.
Count of players that currently joined this lobby.
Count of rooms currently associated with this lobby.
Options for authentication modes. From "classic" auth on each server to AuthOnce (on NameServer).
Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.
Use a custom authentication service. Currently the only implemented option.
Authenticates users by their Steam Account. Set Steam's ticket as "ticket" via AddAuthParameter().
Authenticates users by their Facebook Account. Set Facebooks's tocken as "token" via AddAuthParameter().
Authenticates users by their Oculus Account and token. Set Oculus' userid as "userid" and nonce as "nonce" via AddAuthParameter().
Authenticates users by their PSN Account and token on PS4. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
Authenticates users by their Xbox Account. Pass the XSTS token via SetAuthPostData().
Authenticates users by their HTC Viveport Account. Set userToken as "userToken" via AddAuthParameter().
Authenticates users by their NSA ID. Set token as "token" and appversion as "appversion" via AddAuthParameter(). The appversion is optional.
Authenticates users by their PSN Account and token on PS5. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
Authenticates users with Epic Online Services (EOS). Set token as "token" and ownershipToken as "ownershipToken" via AddAuthParameter(). The ownershipToken is optional.
Authenticates users with Facebook Gaming api. Set token as "token" via AddAuthParameter().
Disables custom authentication. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).
Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
On Photon, user authentication is optional but can be useful in many cases.
If you want to FindFriends, a unique ID per user is very practical.
There are basically three options for user authentication: None at all, the client sets some UserId
or you can use some account web-service to authenticate a user (and set the UserId server-side).
Custom Authentication lets you verify end-users by some kind of login or token. It sends those
values to Photon which will verify them before granting access or disconnecting the client.
The AuthValues are sent in OpAuthenticate when you connect, so they must be set before you connect.
If the AuthValues.UserId is null or empty when it's sent to the server, then the Photon Server assigns a UserId!
The Photon Cloud Dashboard will let you enable this feature and set important server values for it.
https://dashboard.photonengine.com
See AuthType.
The type of authentication provider that should be used. Defaults to None (no auth whatsoever).
Several auth providers are available and CustomAuthenticationType.Custom can be used if you build your own service.
This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.
Maps to operation parameter 216.
Standard http get parameters are used here and passed on to the service that's defined in the server (Photon Cloud Dashboard).
Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).
Maps to operation parameter 214.
Internal Photon token. After initial authentication, Photon provides a token for this client, subsequently used as (cached) validation.
Any token for custom authentication should be set via SetAuthPostData or AddAuthParameter.
The UserId should be a unique identifier per user. This is for finding friends, etc..
See remarks of AuthValues for info about how this is set and used.
Creates empty auth values without any info.
Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.
Some UserId to set in Photon.
Sets the data to be passed-on to the auth service via POST.
AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.
Sets the data to be passed-on to the auth service via POST.
AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
Binary token / auth-data to pass on.
Sets data to be passed-on to the auth service as Json (Content-Type: "application/json") via Post.
AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
A authentication-data dictionary will be converted to Json and passed to the Auth webservice via HTTP Post.
Adds a key-value pair to the get-parameters used for Custom Auth (AuthGetParameters).
This method does uri-encoding for you.
Key for the value to set.
Some value relevant for Custom Authentication.
Transform this object into string.
String info about this object's values.
Make a copy of the current object.
The object to be copied into.
The copied object.
Abstract implementation of PhotonPing, ase for pinging servers to find the "Best Region".
Caches the last exception/error message, if any.
True of the ping was successful.
True if there was any result.
Length of a ping.
Bytes to send in a (Photon UDP) ping.
Randomized number to identify a ping.
Begins sending a ping.
Check if done.
Dispose of this ping.
Initialize this ping (GotResult, Successful, PingId).
Uses C# Socket class from System.Net.Sockets (as Unity usually does).
Incompatible with Windows 8 Store/Phone API.
Sends a "Photon Ping" to a server.
Address in IPv4 or IPv6 format. An address containing a '.' will be interpreted as IPv4.
True if the Photon Ping could be sent.
Check if done.
Dispose of this ping.
Summarizes a "player" within a room, identified (in that room) by ID (or "actorNumber").
Each player has a actorNumber, valid for that room. It's -1 until assigned by server (and client logic).
Used internally to identify the masterclient of a room.
Backing field for property.
Identifier of this player in current room. Also known as: actorNumber or actorNumber. It's -1 outside of rooms.
The ID is assigned per room and only valid in that context. It will change even on leave and re-join. IDs are never re-used per room.
Only one player is controlled by each client. Others are not local.
Background field for nickName.
Non-unique nickname of this player. Synced automatically in a room.
A player might change his own playername in a room (it's only a property).
Setting this value updates the server and other players (using an operation).
UserId of the player, available when the room got created with RoomOptions.PublishUserId = true.
Useful for and blocking slots in a room for expected players (e.g. in ).
True if this player is the Master Client of the current room.
If this player is active in the room (and getting events which are currently being sent).
Inactive players keep their spot in a room but otherwise behave as if offline (no matter what their actual connection status is).
The room needs a PlayerTTL != 0. If a player is inactive for longer than PlayerTTL, the server will remove this player from the room.
For a client "rejoining" a room, is the same as joining it: It gets properties, cached events and then the live events.
Read-only cache for custom properties of player. Set via Player.SetCustomProperties.
Don't modify the content of this Hashtable. Use SetCustomProperties and the
properties of this class to modify values. When you use those, the client will
sync values with the server.
Can be used to store a reference that's useful to know "by player".
Example: Set a player's character as Tag by assigning the GameObject on Instantiate.
Creates a player instance.
To extend and replace this Player, override LoadBalancingPeer.CreatePlayer().
NickName of the player (a "well known property").
ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)
If this is the local peer's player (or a remote one).
Creates a player instance.
To extend and replace this Player, override LoadBalancingPeer.CreatePlayer().
NickName of the player (a "well known property").
ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)
If this is the local peer's player (or a remote one).
A Hashtable of custom properties to be synced. Must use String-typed keys and serializable datatypes as values.
Get a Player by ActorNumber (Player.ID).
ActorNumber of the a player in this room.
Player or null.
Gets this Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
Player or null.
Gets a Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
Useful when you pass something to the next player. For example: passing the turn to the next player.
The Player for which the next is being needed.
Player or null.
Gets a Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
Useful when you pass something to the next player. For example: passing the turn to the next player.
The ActorNumber (Player.ID) for which the next is being needed.
Player or null.
Caches properties for new Players or when updates of remote players are received. Use SetCustomProperties() for a synced update.
This only updates the CustomProperties and doesn't send them to the server.
Mostly used when creating new remote players, where the server sends their properties.
Brief summary string of the Player: ActorNumber and NickName
String summary of the Player: player.ID, name and all custom properties of this user.
Use with care and not every frame!
Converts the customProperties to a String on every single call.
If players are equal (by GetHasCode, which returns this.ID).
Accompanies Equals, using the ID (actorNumber) as HashCode to return.
Used internally, to update this client's playerID when assigned (doesn't change after assignment).
Updates and synchronizes this Player's Custom Properties. Optionally, expectedProperties can be provided as condition.
Custom Properties are a set of string keys and arbitrary values which is synchronized
for the players in a Room. They are available when the client enters the room, as
they are in the response of OpJoin and OpCreate.
Custom Properties either relate to the (current) Room or a Player (in that Room).
Both classes locally cache the current key/values and make them available as
property: CustomProperties. This is provided only to read them.
You must use the method SetCustomProperties to set/modify them.
Any client can set any Custom Properties anytime (when in a room).
It's up to the game logic to organize how they are best used.
You should call SetCustomProperties only with key/values that are new or changed. This reduces
traffic and performance.
Unless you define some expectedProperties, setting key/values is always permitted.
In this case, the property-setting client will not receive the new values from the server but
instead update its local cache in SetCustomProperties.
If you define expectedProperties, the server will skip updates if the server property-cache
does not contain all expectedProperties with the same values.
In this case, the property-setting client will get an update from the server and update it's
cached key/values at about the same time as everyone else.
The benefit of using expectedProperties can be only one client successfully sets a key from
one known value to another.
As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
take the item will have it (and the others fail to set the ownership).
Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
Hashtable of Custom Properties to be set.
If non-null, these are the property-values the server will check as condition for this update.
Defines if this SetCustomProperties-operation gets forwarded to your WebHooks. Client must be in room.
False if propertiesToSet is null or empty or have zero string keys.
True in offline mode even if expectedProperties or webFlags are used.
If not in a room, returns true if local player and expectedValues and webFlags are null.
(Use this to cache properties to be sent when joining a room).
Otherwise, returns if this operation could be sent to the server.
Uses OpSetPropertiesOfActor to sync this player's NickName (server is being updated with this.NickName).
Unlike the CloudRegionCode, this may contain cluster information.
Weighted ping time.
Regions gets pinged 5 times (RegionPinger.Attempts).
Out of those, the worst rtt is discarded and the best will be counted two times for a weighted average.
Provides methods to work with Photon's regions (Photon Cloud) and can be use to find the one with best ping.
When a client uses a Name Server to fetch the list of available regions, the LoadBalancingClient will create a RegionHandler
and provide it via the OnRegionListReceived callback, as soon as the list is available. No pings were sent for Best Region selection yet.
Your logic can decide to either connect to one of those regional servers, or it may use PingMinimumOfRegions to test
which region provides the best ping. Alternatively the client may be set to connect to the Best Region (lowest ping), one or
more regions get pinged.
Not all regions will be pinged. As soon as the results are final, the client will connect to the best region,
so you can check the ping results when connected to the Master Server.
Regions gets pinged 5 times (RegionPinger.Attempts).
Out of those, the worst rtt is discarded and the best will be counted two times for a weighted average.
Usually UDP will be used to ping the Master Servers. In WebGL, WSS is used instead.
It makes sense to make clients "sticky" to a region when one gets selected.
This can be achieved by storing the SummaryToCache value, once pinging was done.
When the client connects again, the previous SummaryToCache helps limiting the number of regions to ping.
In best case, only the previously selected region gets re-pinged and if the current ping is not much worse, this one region is used again.
The implementation of PhotonPing to use for region pinging (Best Region detection).
Defaults to null, which means the Type is set automatically.
A list of region names for the Photon Cloud. Set by the result of OpGetRegions().
Implement ILoadBalancingCallbacks and register for the callbacks to get OnRegionListReceived(RegionHandler regionHandler).
You can also put a "case OperationCode.GetRegions:" into your OnOperationResponse method to notice when the result is available.
When PingMinimumOfRegions was called and completed, the BestRegion is identified by best ping.
This value summarizes the results of pinging currently available regions (after PingMinimumOfRegions finished).
This value should be stored in the client by the game logic.
When connecting again, use it as previous summary to speed up pinging regions and to make the best region sticky for the client.
Provides a list of regions and their pings as string.
Initializes the regions of this RegionHandler with values provided from the Name Server (as OperationResponse for OpGetRegions).
If non-zero, this port will be used to ping Master Servers on.
If the previous Best Region's ping is now higher by this much, ping all regions and find a new Best Region.
How much higher a region's ping can be from the absolute best, to be considered the Best Region (by ping and name).
If the region from a previous BestRegionSummary now has a ping higher than this limit, all regions get pinged again to find a better. Default: 90ms.
Pinging all regions takes time, which is why a BestRegionSummary gets stored.
If that is available, the Best Region becomes sticky and is used again.
This limit introduces an exception: Should the pre-defined best region have a ping worse than this, all regions are considered.
True if the available regions are being pinged currently.
True if the pinging of regions is being aborted.
Creates a new RegionHandler.
If non-zero, this port will be used to ping Master Servers on.
Starts the process of pinging of all available regions.
Provide a method to call when all ping results are available. Aborting the pings will also cancel the callback.
A BestRegionSummary from an earlier RegionHandler run. This makes a selected best region "sticky" and keeps ping times lower.
If pining the regions gets started now. False if the current state prevent this.
Calling this will stop pinging the regions and suppress the onComplete callback.
Privately used to ping regions if the current best one isn't as fast as earlier.
If pinging can be started.
Wraps the ping attempts and workflow for a single region.
How often to ping a region.
How long to wait maximum for a response.
Ping result when pinging failed.
Current ping attempt count.
True if all attempts are done or timed out.
Set to true to abort pining this region.
Initializes a RegionPinger for the given region.
Selects the best fitting ping implementation or uses the one set in RegionHandler.PingImplementation.
PhotonPing instance to use.
Starts the ping routine for the assigned region.
Pinging runs in a ThreadPool worker item or (if needed) in a Thread.
WebGL runs pinging on the Main Thread as coroutine.
True unless Aborted.
Calling this will stop pinging the regions and cancel the onComplete callback.
Pings the region. To be called by a thread.
Affected by frame-rate of app, as this Coroutine checks the socket for a result once per frame.
Gets this region's results as string summary.
Attempts to resolve a hostname into an IP string or returns empty string if that fails.
To be compatible with most platforms, the address family is checked like this:
if (ipAddress.AddressFamily.ToString().Contains("6")) // ipv6...
Hostname to resolve.
IP string or empty string if resolution fails
This class represents a room a client joins/joined.
Contains a list of current players, their properties and those of this room, too.
A room instance has a number of "well known" properties like IsOpen, MaxPlayers which can be changed.
Your own, custom properties can be set via SetCustomProperties() while being in the room.
Typically, this class should be extended by a game-specific implementation with logic and extra features.
A reference to the LoadBalancingClient which is currently keeping the connection and state.
The name of a room. Unique identifier (per region and virtual appid) for a room/match.
The name can't be changed once it's set by the server.
Defines if the room can be joined.
This does not affect listing in a lobby but joining the room will fail if not open.
If not open, the room is excluded from random matchmaking.
Due to racing conditions, found matches might become closed while users are trying to join.
Simply re-connect to master and find another.
Use property "IsVisible" to not list the room.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
Defines if the room is listed in its lobby.
Rooms can be created invisible, or changed to invisible.
To change if a room can be joined, use property: open.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
Sets a limit of players to this room. This property is synced and shown in lobby, too.
If the room is full (players count == maxplayers), joining this room will fail.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
The count of players in this Room (using this.Players.Count).
While inside a Room, this is the list of players who are also in that room.
While inside a Room, this is the list of players who are also in that room.
List of users who are expected to join this room. In matchmaking, Photon blocks a slot for each of these UserIDs out of the MaxPlayers.
The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
Define expected players in the methods: , and .
Player Time To Live. How long any player can be inactive (due to disconnect or leave) before the user gets removed from the playerlist (freeing a slot).
Room Time To Live. How long a room stays available (and in server-memory), after the last player becomes inactive. After this time, the room gets persisted or destroyed.
The ID (actorNumber, actorNumber) of the player who's the master of this Room.
Note: This changes when the current master leaves the room.
Gets a list of custom properties that are in the RoomInfo of the Lobby.
This list is defined when creating the room and can't be changed afterwards. Compare: LoadBalancingClient.OpCreateRoom()
You could name properties that are not set from the beginning. Those will be synced with the lobby when added later on.
Gets if this room cleans up the event cache when a player (actor) leaves.
This affects which events joining players get.
Set in room creation via RoomOptions.CleanupCacheOnLeave.
Within PUN, auto cleanup of events means that cached RPCs and instantiated networked objects are deleted from the room.
Define if the client who calls SetProperties should receive the properties update event or not.
Define if Join and Leave events should not be sent to clients in the room.
Extends SuppressRoomEvents: Define if Join and Leave events but also the actors' list and their respective properties should not be sent to clients.
Define if UserIds of the players are broadcast in the room. Useful for FindFriends and reserving slots for expected users.
Define if actor or room properties with null values are removed on the server or kept.
Creates a Room (representation) with given name and properties and the "listing options" as provided by parameters.
Name of the room (can be null until it's actually created on server).
Room options.
Signal if this room is only used locally.
Read (received) room option flags into related bool parameters.
This is for internal use. The operation response for join and create room operations is read this way.
Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition.
Custom Properties are a set of string keys and arbitrary values which is synchronized
for the players in a Room. They are available when the client enters the room, as
they are in the response of OpJoin and OpCreate.
Custom Properties either relate to the (current) Room or a Player (in that Room).
Both classes locally cache the current key/values and make them available as
property: CustomProperties. This is provided only to read them.
You must use the method SetCustomProperties to set/modify them.
Any client can set any Custom Properties anytime (when in a room).
It's up to the game logic to organize how they are best used.
You should call SetCustomProperties only with key/values that are new or changed. This reduces
traffic and performance.
Unless you define some expectedProperties, setting key/values is always permitted.
In this case, the property-setting client will not receive the new values from the server but
instead update its local cache in SetCustomProperties.
If you define expectedProperties, the server will skip updates if the server property-cache
does not contain all expectedProperties with the same values.
In this case, the property-setting client will get an update from the server and update it's
cached key/values at about the same time as everyone else.
The benefit of using expectedProperties can be only one client successfully sets a key from
one known value to another.
As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
take the item will have it (and the others fail to set the ownership).
Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
Hashtable of Custom Properties that changes.
Provide some keys/values to use as condition for setting the new values. Client must be in room.
Defines if this SetCustomProperties-operation gets forwarded to your WebHooks. Client must be in room.
False if propertiesToSet is null or empty or have zero string keys.
True in offline mode even if expectedProperties or webFlags are used.
Otherwise, returns if this operation could be sent to the server.
Enables you to define the properties available in the lobby if not all properties are needed to pick a room.
Limit the amount of properties sent to users in the lobby to improve speed and stability.
An array of custom room property names to forward to the lobby.
If the operation could be sent to the server.
Removes a player from this room's Players Dictionary.
This is internally used by the LoadBalancing API. There is usually no need to remove players yourself.
This is not a way to "kick" players.
Removes a player from this room's Players Dictionary.
Asks the server to assign another player as Master Client of your current room.
RaiseEvent has the option to send messages only to the Master Client of a room.
SetMasterClient affects which client gets those messages.
This method calls an operation on the server to set a new Master Client, which takes a roundtrip.
In case of success, this client and the others get the new Master Client from the server.
SetMasterClient tells the server which current Master Client should be replaced with the new one.
It will fail, if anything switches the Master Client moments earlier. There is no callback for this
error. All clients should get the new Master Client assigned by the server anyways.
See also: MasterClientId
The player to become the next Master Client.
False when this operation couldn't be done currently. Requires a v4 Photon Server.
Checks if the player is in the room's list already and calls StorePlayer() if not.
The new player - identified by ID.
False if the player could not be added (cause it was in the list already).
Updates a player reference in the Players dictionary (no matter if it existed before or not).
The Player instance to insert into the room.
Tries to find the player with given actorNumber (a.k.a. ID).
Only useful when in a Room, as IDs are only valid per Room.
ID to look for.
If true, the Master Client is returned for ID == 0.
The player with the ID or null.
Attempts to remove all current expected users from the server's Slot Reservation list.
Note that this operation can conflict with new/other users joining. They might be
adding users to the list of expected users before or after this client called ClearExpectedUsers.
This room's expectedUsers value will update, when the server sends a successful update.
Internals: This methods wraps up setting the ExpectedUsers property of a room.
If the operation could be sent to the server.
Attempts to update the expected users from the server's Slot Reservation list.
Note that this operation can conflict with new/other users joining. They might be
adding users to the list of expected users before or after this client called SetExpectedUsers.
This room's expectedUsers value will update, when the server sends a successful update.
Internals: This methods wraps up setting the ExpectedUsers property of a room.
The new array of UserIDs to be reserved in the room.
If the operation could be sent to the server.
Returns a summary of this Room instance as string.
Summary of this Room instance.
Returns a summary of this Room instance as longer string, including Custom Properties.
Summary of this Room instance.
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).
This class resembles info about available rooms, as sent by the Master server's lobby.
Consider all values as readonly. None are synced (only updated by events by server).
Used in lobby, to mark rooms that are no longer listed (for being full, closed or hidden).
Backing field for property.
Backing field for property.
Backing field for property.
Backing field for property.
Backing field for property.
Backing field for property.
Backing field for property.
Backing field for property. False unless the GameProperty is set to true (else it's not sent).
Backing field for property.
Backing field for master client id (actorNumber). defined by server in room props and ev leave.
Backing field for property.
Read-only "cache" of custom properties of a room. Set via Room.SetCustomProperties (not available for RoomInfo class!).
All keys are string-typed and the values depend on the game/application.
The name of a room. Unique identifier for a room/match (per AppId + game-Version).
Count of players currently in room. This property is overwritten by the Room class (used when you're in a Room).
The limit of players for this room. This property is shown in lobby, too.
If the room is full (players count == maxplayers), joining this room will fail.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
Defines if the room can be joined.
This does not affect listing in a lobby but joining the room will fail if not open.
If not open, the room is excluded from random matchmaking.
Due to racing conditions, found matches might become closed even while you join them.
Simply re-connect to master and find another.
Use property "IsVisible" to not list the room.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
Defines if the room is listed in its lobby.
Rooms can be created invisible, or changed to invisible.
To change if a room can be joined, use property: open.
As part of RoomInfo this can't be set.
As part of a Room (which the player joined), the setter will update the server and all clients.
Constructs a RoomInfo to be used in room listings in lobby.
Name of the room and unique ID at the same time.
Properties for this room.
Makes RoomInfo comparable (by name).
Accompanies Equals, using the name's HashCode as return.
Returns most interesting room values as string.
Summary of this RoomInfo instance.
Returns most interesting room values as string, including custom properties.
Summary of this RoomInfo instance.
Copies "well known" properties to fields (IsVisible, etc) and caches the custom properties (string-keys only) in a local hashtable.
New or updated properties to store in this RoomInfo.
Helper class to debug log basic information about Photon client and vital traffic statistics.
Set SupportLogger.Client for this to work.
Toggle to enable or disable traffic statistics logging.
helps skip the initial OnApplicationPause call, which is not really of interest on start
Photon client to log information and statistics from.
Debug logs vital traffic statistics about the attached Photon Client.
Debug logs basic information (AppId, AppVersion, PeerID, Server address, Region) about the attached Photon Client.
The SystemConnectionSummary (SBS) is useful to analyze low level connection issues in Unity. This requires a ConnectionHandler in the scene.
A LoadBalancingClient automatically creates a SystemConnectionSummary on these disconnect causes:
DisconnectCause.ExceptionOnConnect, DisconnectCause.Exception, DisconnectCause.ServerTimeout and DisconnectCause.ClientTimeout.
The SBS can then be turned into an integer (ToInt()) or string to debug the situation or use in analytics.
Both, ToString and ToInt summarize the network-relevant conditions of the client at and before the connection fail, including the PhotonPeer.SocketErrorCode.
Important: To correctly create the SBS instance, a ConnectionHandler component must be present and enabled in the
Unity scene hierarchy. In best case, keep the ConnectionHandler on a GameObject which is flagged as
DontDestroyOnLoad.
28 and up. 4 bits.
25 and up. 3 bits.
Creates a SystemConnectionSummary for an incident of a local LoadBalancingClient. This gets used automatically by the LoadBalancingClient!
If the LoadBalancingClient.SystemConnectionSummary is non-null after a connection-loss, you can call .ToInt() and send this to analytics or log it.
Creates a SystemConnectionSummary instance from an int (reversing ToInt()). This can then be turned into a string again.
An int, as provided by ToInt(). No error checks yet.
Turns the SystemConnectionSummary into an integer, which can be be used for analytics purposes. It contains a lot of info and can be used to instantiate a new SystemConnectionSummary.
Compact representation of the context for a disconnect issue.
A readable debug log string of the context for network problems.
SystemConnectionSummary as readable string.
Applies bitval to bitpos (no matter value's initial bit value).
Applies bitvals via OR operation (expects bits in value to be 0 initially).
Reads an operation response of a WebRpc and provides convenient access to most common values.
See LoadBalancingClient.OpWebRpc.
Create a WebRpcResponse to access common result values.
The operationResponse.OperationCode should be: OperationCode.WebRpc.
Name of the WebRpc that was called.
ResultCode of the WebService that answered the WebRpc.
0 is: "OK" for WebRPCs.
-1 is: No ResultCode by WebRpc service (check ).
Other ResultCode are defined by the individual WebRpc and service.
Might be empty or null.
Other key/values returned by the webservice that answered the WebRpc.
An OperationResponse for a WebRpc is needed to read it's values.
Turns the response into an easier to read string.
String resembling the result.
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.
Indicates whether to forward HTTP request to web service or not.
Indicates whether to send AuthCookie of actor in the HTTP request to web service or not.
Indicates whether to send HTTP request synchronously or asynchronously to web service.
Indicates whether to send serialized game state in HTTP request to web service or not.
Select the Relayed Connection Encryption Mode
Photon Session EmptyRoomTTL. Valid only in Shared Mode.
Collection of connection-relevant settings, used internally by PhotonNetwork.ConnectUsingSettings.
Includes the AppSettings class from the Realtime APIs plus some other, PUN-relevant, settings.
The photon settings class, which is wrapped by this ScriptableObject.
Serialized server settings, written by the Setup Wizard for use in ConnectUsingSettings.
Holds a Custom Session Property value
Internal stored value
Get the Type of the internal stored value
Signal if this Session Property is a int value
Signal if this Session Property is a string value
Signal if this Session Property is a bool value
Convert a into int
Convert a int into a
Convert a into string
Convert a string into a
Convert a into bool
Convert a bool into a
Signal if a particular object is supported as a
Object ref to check
True if obj is of a supported type, false otherwise
Convert a particular object into a .
Check the object type support using .
If the object type is not supported, will be thrown.
Object reference to be converted
Instance of a if type is supported, null otherwise
If the object type passed as argument is not supported