Enums

ErrorCode

ErrorCode is the machine-readable code carried by every Error a failed operation returns. The numeric values are grouped by area: general, connection, authentication, room and matchmaking, operation, server, client state and events. The event codes are reported on OnError rather than through a failed operation; see Custom Events and Structured Payloads.

Area Name Value Description
General Ok 0 No error. GetErrorCode() returns this for successful results.
General Unknown -1 An error that maps to no other code.
Connection ConnectionFailed 1 The connection could not be established.
Connection Disconnected 2 The operation failed because the connection was lost.
Connection Timeout 3 The operation or connection timed out.
Connection ServerFull 4 The server cannot accept more connections.
Authentication InvalidAuthentication 10 The App Id or authentication values were rejected.
Authentication CustomAuthenticationFailed 11 The custom authentication provider rejected the credentials.
Authentication AuthenticationTicketExpired 12 The authentication ticket expired; authenticate again.
Authentication MaxCCUReached 13 The application reached its concurrent-user limit.
Authentication InvalidRegion 14 The requested region is not available for this application.
Authentication ClientVersionTooOld 15 The client version is no longer accepted by the server.
Room and matchmaking RoomFull 20 The room reached its maximum player count.
Room and matchmaking RoomClosed 21 The room is closed and does not accept joins.
Room and matchmaking RoomNotFound 22 No room with the given name exists.
Room and matchmaking RoomAlreadyExists 23 A room with the given name already exists.
Room and matchmaking NoMatchFound 24 Random matchmaking found no matching room.
Room and matchmaking AlreadyJoined 25 The client already joined this room.
Room and matchmaking SlotError 26 A reserved slot (ExpectedUsers) could not be fulfilled.
Operation OperationDenied 30 The server denied the operation.
Operation OperationInvalid 31 The operation or its parameters are invalid.
Operation OperationLimitReached 32 The operation limit was reached.
Operation RateLimited 33 The client sends operations faster than allowed.
Server InternalServerError 40 The server encountered an internal error.
Server PluginError 41 A server-side plugin reported an error.
Server ServerDisconnect 42 The server disconnected the client.
Client state NotConnected 50 The operation requires a connection.
Client state NotInRoom 51 The operation requires being in a room.
Client state InvalidState 52 The operation is not allowed in the client's current state.
Event EventSizeMismatch 53 An incoming event payload did not match sizeof(T) of a SubscribeEvent<T>() subscription.
Event EventEncodeFailed 54 An outgoing event payload could not be encoded from a RealtimeValue.
Event EventDecodeFailed 55 An incoming event payload could not be decoded into a RealtimeValue.
Event EventPayloadTypeMismatch 56 An incoming event payload did not match the subscribed payload form.

See Errors and Disconnects for handling guidance.

DisconnectCause

DisconnectCause is reported by the OnDisconnected callback and remains readable through GetDisconnectCause() after a connection ends.

Name Value Description Reconnect?
None 0 No disconnect has been recorded.
DisconnectByServerUserLimit 1 The server closed the connection because its user limit is reached. Later; an immediate retry fails again.
ExceptionOnConnect 2 The connection could not be established, for example because the server is unreachable or the port is blocked. Yes, with backoff; consider another protocol or the alternative ports.
DisconnectByServer 3 The server actively closed the connection. Yes, with backoff.
DisconnectByServerLogic 4 Server-side logic, such as a plugin, disconnected the client. Usually not; the disconnect is deliberate.
TimeoutDisconnect 5 The connection timed out because acknowledgements stopped arriving. Yes; Reconnect() is made for this case.
Exception 6 A local network exception ended the connection. Yes, with backoff.
InvalidAuthentication 7 The App Id or authentication values were rejected. No; fix the credentials first.
MaxCCUReached 8 The application reached its concurrent-user limit. Later, when capacity frees up.
InvalidRegion 9 The requested region is not available for this application. No; choose a different region.
OperationNotAllowedInCurrentState 10 An operation was called in a state that does not allow it. No; fix the call order.
CustomAuthenticationFailed 11 The custom authentication provider rejected the credentials. No; fix the credentials first.
ClientVersionTooOld 12 The client version is no longer accepted by the server. No; update the client.
ClientVersionInvalid 13 The client reported an invalid version. No; fix the client version.
DashboardVersionInvalid 14 The application's dashboard configuration rejects this client version. No; fix the dashboard settings.
AuthenticationTicketExpired 15 The authentication ticket expired during the session. Yes, after authenticating again.
DisconnectByOperationLimit 16 The server disconnected the client for exceeding the operation rate limit. Yes, after reducing the call rate.

ConnectionState

ConnectionState is returned by GetState() and describes the client's coarse position in the connection lifecycle.

Name Description
Disconnected No connection; the initial state and the state after every disconnect.
Connecting A connect or reconnect is in progress.
Connected Connected and authenticated; ready for matchmaking.
JoiningRoom A room create or join operation is in progress.
InRoom The client is inside a room.
LeavingRoom A leave-room operation is in progress.
Disconnecting A graceful disconnect is in progress.

ConnectionProtocol

Name Value Description
UDP 0 Photon's reliable UDP transport; the recommended protocol where available.
TCP 1 TCP transport.
WS 4 Unencrypted WebSocket transport.
WSS 5 Encrypted WebSocket transport (TLS).
Default platform dependent Resolves to WS on WebAssembly builds and to UDP everywhere else.

RegionSelectionMode

Name Value Description
Default 0 Connects without an explicit region choice; the first region returned by the name server is used.
Select 1 Manual selection: coordinate AvailableRegions(), SelectRegion() and Connect() as described in Connection and Regions.
Best 2 Pings the available regions and connects to the one with the lowest latency automatically.

CustomAuthenticationType

Name Value Description
None 255 No custom authentication; the default.
Custom 0 Your own authentication provider behind a web endpoint.
Steam 1 Steam session-ticket authentication.
Facebook 2 Facebook authentication.
Oculus 3 Oculus authentication.
PlayStation4 4 PlayStation 4 authentication.
Xbox 5 Xbox authentication.
Viveport 10 Viveport authentication.
NintendoSwitch 11 Nintendo Switch authentication.
PlayStation5 12 PlayStation 5 authentication.
Epic 13 Epic Online Services authentication.
FacebookGaming 15 Facebook Gaming authentication.

LobbyType

Name Value Description
Default 0 The standard lobby; pushes room list updates and supports random matchmaking with property filters.
SqlLobby 2 Lobby with SQL-like filter matchmaking over the C0 to C9 room properties. See SQL Lobby Matchmaking.

MatchmakingMode

Name Value Description
FillRoom 0 Fills existing rooms first, so rooms reach their player count quickly; the default.
SerialMatching 1 Distributes players evenly across the matching rooms.
RandomMatching 2 Picks one of the matching rooms at random.

ReceiverGroup

Name Value Description
Others 0 All players in the room except the sender; the default.
All 1 All players in the room, including the sender.
MasterClient 2 Only the master client.

EventCache

Name Value Description
DoNotCache 0 The event is delivered and forgotten; the default.
MergeCache 1 Merges the event data into the sender's cached event for this event code.
ReplaceCache 2 Replaces the sender's cached event for this event code.
RemoveCache 3 Removes the sender's cached event for this event code.
AddToRoomCache 4 Adds the event to the room's event cache; players who join later receive it on entry.
AddToRoomCacheGlobal 5 Adds the event to the room cache without tying it to the sender, so it survives the sender leaving.
RemoveFromRoomCache 6 Removes matching events from the room cache.
RemoveFromRoomCacheForActorsLeft 7 Removes cached events of the players who already left the room.
SliceIncIndex 10 Increments the room's cache slice index.
SliceSetIndex 11 Sets the room's cache slice index to EventOptions.CacheSliceIndex.
SlicePurgeIndex 12 Purges the cached events of one slice index.
SlicePurgeUpToIndex 13 Purges all cached events up to a slice index.

The Event Caching page explains the caching model.

DirectMode

Name Value Description
None 0 Direct messaging is disabled; the default.
AllToOthers 1 Every player opens direct connections to every other player.
MasterToOthers 2 Direct connections exist only between the master client and the other players.
AllToAll 3 Every player connects to every player, including a loopback to itself.
MasterToAll 4 The master client connects to every player, including a loopback to itself.

LogLevel

Name Value Description
Trace 1 Most verbose output for detailed tracing.
Debug 2 Diagnostic output for development.
Info 4 Informational messages.
Warning 8 Unexpected conditions the SDK recovered from.
Error 16 Errors the SDK could not recover from.

The values are bit flags and combine with the bitwise operators; see Logging for enabling levels.

Back to top