Enums

Every enumeration on this page lists the C++ name of each member and, where the web build supports the member, its JavaScript name. The error and warning enumerations also list their C API names. JavaScript enumerations are camelCase string unions: you pass and read the string, for example 'sqlLobby'. A matching export maps each name to the number in the Value column, for example LobbyTypeValues.sqlLobby is 2; for ErrorCode the export is ErrorCodes. A member the web build lacks has no JavaScript name and is marked with a dash; see Web Build Differences.

ErrorCode

ErrorCode lists every code a client operation or the error callback can report. Each operation reports a narrower set of these codes instead, listed under Operation Error Enums. A code keeps the same name and value in every set it appears in. In C++ the code is the Code of the Error an operation returns, and every narrower enum widens implicitly to ErrorCode. The codes every operation shares (Disconnected, NotConnected, AlreadyConnected, OperationPending, RequestFailed, InvalidArgument) take their C++ values from RealtimeCore::Common::ErrorCode. The C API declares them in RealtimeErrorCode, each prefixed with the enum name, such as RealtimeErrorCode_RoomFull. In JavaScript the code is the code of the RealtimeError the promise rejects with, and codeValue holds the number. The values are grouped by area: general, connection, authentication, room and matchmaking, operation, server and events. The event codes are reported through the error callback (OnError in C++, the error event in JavaScript) rather than through a failed operation; see Custom Events and Structured Payloads.

Area C++ JavaScript Value Description
General Ok 'ok' 0 No error. In C++ GetErrorCode() returns this for successful results.
General Unknown 'unknown' -1 An error that maps to no other code; the message names the server's code.
Connection ConnectionFailed 'connectionFailed' 1 The connection could not be established.
Connection Disconnected 'disconnected' 2 The connection was lost while the operation was pending. In JavaScript, pending operations of a disposed client also reject with this code, except a pending disconnect(), which resolves.
Connection ServerFull 'serverFull' 4 The server cannot accept more connections.
Connection NotConnected 'notConnected' 50 The operation requires a connection.
Connection AlreadyConnected 'alreadyConnected' 57 The client is already connected or connecting.
Authentication InvalidAuthentication 'invalidAuthentication' 10 The App Id or authentication values were rejected.
Authentication CustomAuthenticationFailed 'customAuthenticationFailed' 11 The custom authentication provider rejected the credentials.
Authentication AuthenticationTicketExpired 'authenticationTicketExpired' 12 The authentication ticket expired; authenticate again.
Authentication MaxCCUReached 'maxCcuReached' 13 The application reached its concurrent-user limit.
Authentication InvalidRegion 'invalidRegion' 14 The requested region is not available for this application.
Authentication ClientVersionTooOld 'clientVersionTooOld' 15 The client version is no longer accepted by the server.
Room and matchmaking RoomFull 'roomFull' 20 The room reached its maximum player count.
Room and matchmaking RoomClosed 'roomClosed' 21 The room is closed and does not accept joins.
Room and matchmaking RoomNotFound 'roomNotFound' 22 No room with the given name exists.
Room and matchmaking RoomAlreadyExists 'roomAlreadyExists' 23 A room with the given name already exists.
Room and matchmaking NoMatchFound 'noMatchFound' 24 Random matchmaking found no matching room.
Room and matchmaking AlreadyJoined 'alreadyJoined' 25 The user is already, or still inactively, in the room.
Room and matchmaking SlotError 'slotError' 26 A reserved slot (ExpectedUsers) could not be fulfilled.
Room and matchmaking NotInRoom 'notInRoom' 51 The operation requires being in a room.
Room and matchmaking AlreadyInRoom 'alreadyInRoom' 58 The operation requires not being in a room.
Room and matchmaking RejoinNotFound 'rejoinNotFound' 62 A rejoin was requested, but the user is not an inactive member of the room.
Room and matchmaking UserExcluded 'userExcluded' 63 The room's expected or excluded users do not admit this user.
Operation OperationDenied 'operationDenied' 30 The server denied the operation.
Operation OperationInvalid 'operationInvalid' 31 The server rejected the operation as invalid.
Operation OperationLimitReached 'operationLimitReached' 32 Operations were issued faster than the server allows.
Operation OperationPending 'operationPending' 59 The same operation is already in progress.
Operation RequestFailed 'requestFailed' 60 The request could not be issued, for example because the client is in the wrong state for it.
Operation InvalidArgument 'invalidArgument' 61 An argument was rejected before the request was sent.
Server InternalServerError 'internalServerError' 40 The server encountered an internal error.
Server PluginError 'pluginError' 41 A server-side plugin reported an error.
Event EventSizeMismatch 'eventSizeMismatch' 53 An incoming event payload did not match sizeof(T) of a SubscribeEvent<T>() subscription.
Event EventEncodeFailed 'eventEncodeFailed' 54 An outgoing event payload could not be encoded from a RealtimeValue.
Event EventDecodeFailed 'eventDecodeFailed' 55 An incoming event payload could not be decoded into a RealtimeValue.
Event EventPayloadTypeMismatch 'eventPayloadTypeMismatch' 56 An incoming event payload did not match the subscribed payload form.

See Errors and Disconnects for handling guidance.

Operation Error Enums

Each operation reports only the codes listed for it below, a subset of ErrorCode. In C++, each operation completes with a Result<T, E> whose E is the operation's enum; the enums live in RealtimeCore/Matchmaking/OperationErrors.h and widen implicitly to ErrorCode. The C API declares the same enums with a Realtime prefix, such as RealtimeJoinRoomError_RoomFull, and the operation's result event carries the code in mode. In JavaScript, each enum is a string union type, and a failed operation's promise rejects with a RealtimeError whose code is one of that operation's codes. Every enum also contains Ok and Unknown; a server code the operation cannot report arrives as Unknown, with the server's code in the message. The Codes column uses the C++ names; the JavaScript names are the strings from the ErrorCode table.

C++ C JavaScript Reported By Codes
ConnectError RealtimeConnectError ConnectErrorCode Connecting and reconnecting ConnectionFailed, Disconnected, ServerFull, InvalidAuthentication, CustomAuthenticationFailed, AuthenticationTicketExpired, MaxCCUReached, InvalidRegion, ClientVersionTooOld, OperationDenied, OperationInvalid, InternalServerError, AlreadyConnected, OperationPending
DisconnectError RealtimeDisconnectError DisconnectErrorCode Disconnecting OperationPending
RegionError RealtimeRegionError RegionErrorCode Listing the available regions and selecting a region Disconnected, OperationPending, RequestFailed
LobbyError RealtimeLobbyError LobbyErrorCode Joining and leaving a lobby, requesting lobby statistics Disconnected, NotConnected, OperationPending, RequestFailed
RoomListError RealtimeRoomListError RoomListErrorCode Querying the room list of a lobby Disconnected, NotConnected, OperationPending, RequestFailed
CreateRoomError RealtimeCreateRoomError CreateRoomErrorCode Creating a room Disconnected, RoomAlreadyExists, SlotError, OperationDenied, OperationInvalid, OperationLimitReached, InternalServerError, PluginError, NotConnected, AlreadyInRoom, OperationPending, RequestFailed
JoinRoomError RealtimeJoinRoomError JoinRoomErrorCode Joining a room by name, join-or-create, random join and random join-or-create the CreateRoomError codes plus RoomFull, RoomClosed, RoomNotFound, NoMatchFound, AlreadyJoined, RejoinNotFound, UserExcluded, InvalidArgument
LeaveRoomError RealtimeLeaveRoomError LeaveRoomErrorCode Leaving a room Disconnected, OperationDenied, OperationInvalid, InternalServerError, PluginError, NotInRoom, OperationPending, RequestFailed
FindFriendsError RealtimeFindFriendsError FindFriendsErrorCode Finding friends Disconnected, NotConnected, OperationPending, RequestFailed, InvalidArgument
ClientError RealtimeClientError ClientErrorCode The error callback ConnectionFailed, OperationDenied, OperationInvalid, OperationLimitReached, InternalServerError, PluginError, EventSizeMismatch, EventEncodeFailed, EventDecodeFailed, EventPayloadTypeMismatch, RequestFailed

WarningCode

WarningCode is the code of a non-fatal warning: the code of OnWarning in C++, the origin of the Warning event over the C API, where the enum is RealtimeWarningCode, and the code of the warning event's { code, message } payload in JavaScript. In JavaScript, a warning value the package does not know reads as 'unknown'.

C++ C JavaScript Value Description
Unknown RealtimeWarningCode_Unknown 'unknown' -1 A warning that maps to no other code; the message names the underlying Photon status code.
OutgoingReliableQueueFilling RealtimeWarningCode_OutgoingReliableQueueFilling 'outgoingReliableQueueFilling' 1 The outgoing reliable command queue is filling up. Call Service() more often.
OutgoingUnreliableQueueFilling RealtimeWarningCode_OutgoingUnreliableQueueFilling 'outgoingUnreliableQueueFilling' 2 The outgoing unreliable command queue is filling up. Call Service() more often.
OutgoingAcksQueueFilling RealtimeWarningCode_OutgoingAcksQueueFilling 'outgoingAcksQueueFilling' 3 The outgoing acknowledgement queue is filling up. Call Service() more often.
IncomingReliableQueueFilling RealtimeWarningCode_IncomingReliableQueueFilling 'incomingReliableQueueFilling' 4 The incoming reliable command queue is filling up. Dispatch incoming commands more often.
IncomingUnreliableQueueFilling RealtimeWarningCode_IncomingUnreliableQueueFilling 'incomingUnreliableQueueFilling' 5 The incoming unreliable command queue is filling up. Dispatch incoming commands more often.
SentQueueFilling RealtimeWarningCode_SentQueueFilling 'sentQueueFilling' 6 The queue of sent reliable commands awaiting acknowledgement is filling up; the server is not acknowledging them.

In JavaScript, servicing the client more often means a shorter pump interval or more frequent client.service() calls; see The Pump. See Errors and Disconnects for handling guidance.

DisconnectCause

DisconnectCause is reported by the disconnected callback (OnDisconnected in C++, the disconnected event in JavaScript) and stays readable after a connection ends, through GetDisconnectCause() in C++ and client.disconnectCause in JavaScript.

C++ JavaScript Value Description Reconnect?
None 'none' 0 No disconnect has been recorded. —
DisconnectByServerUserLimit 'disconnectByServerUserLimit' 1 The server closed the connection because its user limit is reached. Later; an immediate retry fails again.
ExceptionOnConnect '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 'disconnectByServer' 3 The server actively closed the connection. Yes, with backoff.
DisconnectByServerLogic 'disconnectByServerLogic' 4 Server-side logic, such as a plugin, disconnected the client. Usually not; the disconnect is deliberate.
TimeoutDisconnect 'timeoutDisconnect' 5 The connection timed out because acknowledgements stopped arriving. Yes; reconnecting (Reconnect() in C++, reconnect() in JavaScript) is made for this case.
Exception 'exception' 6 A local network exception ended the connection. Yes, with backoff.
InvalidAuthentication 'invalidAuthentication' 7 The App Id or authentication values were rejected. No; fix the credentials first.
MaxCCUReached 'maxCcuReached' 8 The application reached its concurrent-user limit. Later, when capacity frees up.
InvalidRegion 'invalidRegion' 9 The requested region is not available for this application. No; choose a different region.
OperationNotAllowedInCurrentState 'operationNotAllowedInCurrentState' 10 An operation was called in a state that does not allow it. No; fix the call order.
CustomAuthenticationFailed 'customAuthenticationFailed' 11 The custom authentication provider rejected the credentials. No; fix the credentials first.
ClientVersionTooOld 'clientVersionTooOld' 12 The client version is no longer accepted by the server. No; update the client.
ClientVersionInvalid 'clientVersionInvalid' 13 The client reported an invalid version. No; fix the client version.
DashboardVersionInvalid 'dashboardVersionInvalid' 14 The application's dashboard configuration rejects this client version. No; fix the dashboard settings.
AuthenticationTicketExpired 'authenticationTicketExpired' 15 The authentication ticket expired during the session. Yes, after authenticating again.
DisconnectByOperationLimit 'disconnectByOperationLimit' 16 The server disconnected the client for exceeding the operation rate limit. Yes, after reducing the call rate.

ConnectionState

ConnectionState describes the client's coarse position in the connection lifecycle; read it with GetState() in C++ and client.state in JavaScript.

C++ JavaScript Description
Disconnected 'disconnected' No connection; the initial state and the state after every disconnect.
Connecting 'connecting' A connect or reconnect is in progress.
Connected 'connected' Connected and authenticated; ready for matchmaking.
JoiningRoom 'joiningRoom' A room create or join operation is in progress.
InRoom 'inRoom' The client is inside a room.
LeavingRoom 'leavingRoom' A leave-room operation is in progress.
Disconnecting 'disconnecting' A graceful disconnect is in progress.

ConnectionProtocol

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

The web build speaks WebSocket only. In JavaScript, leaving the protocol option out selects 'wss', which a page served over https:// requires.

RegionSelectionMode

C++ JavaScript Value Description
Default 'default' 0 Connects without an explicit region choice; the first region returned by the name server is used.
Select 'select' 1 Manual selection: list the regions, select one and connect, as described in Connection and Regions.
Best — 2 Pings the available regions and connects to the one with the lowest latency automatically. The web build cannot ping regions.

CustomAuthenticationType

C++ JavaScript Value Description
None 'none' 255 No custom authentication; the default.
Custom 'custom' 0 Your own authentication provider behind a web endpoint.
Steam 'steam' 1 Steam session-ticket authentication.
Facebook 'facebook' 2 Facebook authentication.
Oculus 'oculus' 3 Oculus authentication.
PlayStation4 'playStation4' 4 PlayStation 4 authentication.
Xbox 'xbox' 5 Xbox authentication.
Viveport 'viveport' 10 Viveport authentication.
NintendoSwitch 'nintendoSwitch' 11 Nintendo Switch authentication.
PlayStation5 'playStation5' 12 PlayStation 5 authentication.
Epic 'epic' 13 Epic Online Services authentication.
FacebookGaming 'facebookGaming' 15 Facebook Gaming authentication.

LobbyType

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

MatchmakingMode

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

ReceiverGroup

C++ JavaScript Value Description
Others 'others' 0 All players in the room except the sender; the default.
All 'all' 1 All players in the room, including the sender.
MasterClient 'masterClient' 2 Only the master client.

EventCache

C++ JavaScript Value Description
DoNotCache 'doNotCache' 0 The event is delivered and forgotten; the default.
AddToRoomCache 'addToRoomCache' 4 Adds the event to the room's event cache; players who join later receive it on entry.
AddToRoomCacheGlobal 'addToRoomCacheGlobal' 5 Adds the event to the room cache without tying it to the sender, so it survives the sender leaving.
RemoveFromRoomCache 'removeFromRoomCache' 6 Removes matching events from the room cache.
RemoveFromRoomCacheForActorsLeft 'removeFromRoomCacheForActorsLeft' 7 Removes cached events of the players who already left the room.

The Event Caching page explains the caching model.

DirectMode

C++ JavaScript Value Description
None '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 'allToAll' 3 Every player connects to every player, including a loopback to itself.
MasterToAll 'masterToAll' 4 The master client connects to every player, including a loopback to itself.

The web build has no peer-to-peer transport: the JavaScript names omit the two peer-to-peer modes, and the remaining modes relay through the server.

LogLevel

No JavaScript function takes a LogLevel: a JavaScript client keeps the default levels and writes the SDK's log lines to the console, through the console method that matches the line's level. The JavaScript names below only label those levels; see Logging.

C++ JavaScript Value Description
Trace 'trace' 1 Most verbose output for detailed tracing.
Debug 'debug' 2 Diagnostic output for development.
Info 'info' 4 Informational messages.
Warning 'warning' 8 Unexpected conditions the SDK recovered from.
Error 'error' 16 Errors the SDK could not recover from.

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

Last updated on

Back to top