Skip to content

realtime

Francisco Dias edited this page Jul 4, 2026 · 1 revision

Realtime

The Realtime module is the core of the extension: it connects to the Photon Cloud, joins matchmaking lobbies and rooms, and sends and receives events between players. Player and room custom properties have their own modules (Realtime Player Properties and Realtime Room Properties), and connection diagnostics live in Realtime Peer.

Note

After connecting you must call photon_realtime_service every step for the client to send and receive.

Lifecycle

Initialise, connect, and service the client:

Lobby & room operations

Join lobbies, and create, join and leave rooms:

Sending & receiving events

Raise custom events and read buffered binary events:

State & info

Query connection and room state:

Settings

Tune connection behaviour:

Room & player info

Query the current room and its players:

Callbacks

Register and remove the event callbacks:

Structs

The Realtime module uses the following structs:

Constants

The Realtime module defines the following constants:



Back To Top

photon_realtime_init

Initialises the Realtime client. Call this once before any other Realtime function.


Syntax:

photon_realtime_init()

Returns:

Boolean

Whether initialisation succeeded.



Back To Top

photon_realtime_shutdown

Shuts the Realtime client down and releases its resources. Call photon_realtime_disconnect first if still connected.


Syntax:

photon_realtime_shutdown()

Returns:

Boolean

Whether the client was shut down.



Back To Top

photon_realtime_service

Dispatches queued incoming and outgoing traffic for the Realtime client. This must be called every step while connected, otherwise the client neither sends nor receives.


Syntax:

photon_realtime_service()

Returns:

Boolean

Whether the client was serviced.



Back To Top

photon_realtime_connect

Connects to the Photon Cloud using the given Application ID and application version. The App ID identifies your Photon Realtime application; the version string keeps incompatible client builds apart. The result is delivered to the photon_realtime_set_callback_connected callback.


Syntax:

photon_realtime_connect(app_id, app_version, options=undefined)
Argument Type Description
app_id String Your Photon Realtime Application ID.
app_version String A version string of your choosing for your game build.
options PhotonRealtimeConnectOptions Optional connection options.

Returns:

Boolean

Whether the connection attempt started.


Example:

var _app_id = extension_get_option_value("GMPhoton", "appIdRealtime");
photon_realtime_connect(_app_id, "1.0", new PhotonRealtimeConnectOptions());


Back To Top

photon_realtime_disconnect

Disconnects the Realtime client from the Photon Cloud. The photon_realtime_set_callback_disconnected callback fires once the disconnect completes.


Syntax:

photon_realtime_disconnect()

Returns:

Boolean

Whether the disconnect started.



Back To Top

photon_realtime_select_region

Selects the Photon Cloud region to connect to (for example "eu", "us", "asia"). Call before connecting, or in response to photon_realtime_set_callback_available_regions.


Syntax:

photon_realtime_select_region(region)
Argument Type Description
region String The region token to use.

Returns:

Boolean

Whether the region was selected.



Back To Top

photon_realtime_reconnect_and_rejoin

Attempts to reconnect to the last game server and rejoin the room the client was previously in. Useful for recovering from a temporary disconnect.


Syntax:

photon_realtime_reconnect_and_rejoin()

Returns:

Boolean

Whether the reconnect attempt started.



Back To Top

photon_realtime_fetch_server_timestamp

Requests the current server timestamp. Once available it can be read with photon_realtime_get_server_time.


Syntax:

photon_realtime_fetch_server_timestamp()

Returns:

Boolean

Whether the request was sent.



Back To Top

photon_realtime_operation_join_lobby

Joins a matchmaking lobby. While in a lobby the client receives room-list and lobby-stats updates.


Syntax:

photon_realtime_operation_join_lobby(lobby_name, lobby_type, callback=undefined)
Argument Type Description
lobby_name String The name of the lobby to join.
lobby_type PhotonRealtimeLobbyType The lobby type.
callback Function Optional callback invoked with no arguments when the join completes.

Returns:

Boolean

Whether the operation was sent.



Back To Top

photon_realtime_operation_leave_lobby

Leaves the current matchmaking lobby.


Syntax:

photon_realtime_operation_leave_lobby(callback=undefined)
Argument Type Description
callback Function Optional callback invoked with no arguments when the operation completes.

Returns:

Boolean

Whether the operation was sent.



Back To Top

photon_realtime_operation_create_room

Creates a new room and joins it. Fails if a room with the same name already exists.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_create_room(room_name, options, custom_properties, callback=undefined)
Argument Type Description
room_name String The name of the room to create.
options PhotonRealtimeRoomOptions The room configuration.
custom_properties Struct Custom room properties as a GML struct.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success).
error_string String A human-readable result message.
room_name String The name of the room that was created.
local_player_number Real The local player's actor number in the room.

Example:

var _opts = new PhotonRealtimeRoomOptions();
_opts.max_players = 4;
photon_realtime_operation_create_room("arena", _opts, { map: "desert" }, function(_error_code, _error_string, _room_name, _player_number) {
    if (_error_code == PhotonRealtimeAppErrorCode.Ok) show_debug_message($"Created {_room_name}");
});


Back To Top

photon_realtime_operation_join_or_create_room

Joins the named room, creating it with the given options if it does not yet exist.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_join_or_create_room(room_name, options, custom_properties, cache_slice_index=undefined, callback=undefined)
Argument Type Description
room_name String The name of the room to join or create.
options PhotonRealtimeRoomOptions The room configuration used if the room is created.
custom_properties Struct Custom room properties as a GML struct (used on creation).
cache_slice_index Real Optional event-cache slice index to fetch on join.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success).
error_string String A human-readable result message.
room_name String The name of the room that was joined or created.
local_player_number Real The local player's actor number in the room.


Back To Top

photon_realtime_operation_join_room

Joins an existing room by name.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_join_room(room_name, options, callback=undefined)
Argument Type Description
room_name String The name of the room to join.
options PhotonRealtimeJoinRoomOptions The join options.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success).
error_string String A human-readable result message.
room_name String The name of the room that was joined.
local_player_number Real The local player's actor number in the room.


Back To Top

photon_realtime_operation_join_random_room

Joins a random room matching the given criteria and expected properties.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_join_random_room(options, expected_properties, callback=undefined)
Argument Type Description
options PhotonRealtimeJoinRandomOptions The matchmaking options.
expected_properties Struct Custom properties a room must match, as a GML struct.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success; NoMatchFound if no room matched).
error_string String A human-readable result message.
room_name String The name of the room that was joined.
local_player_number Real The local player's actor number in the room.


Back To Top

photon_realtime_operation_leave_room

Leaves the current room.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_leave_room(will_come_back, send_authentication_cookie, callback=undefined)
Argument Type Description
will_come_back Boolean If true, the player stays as an inactive actor so they can rejoin later.
send_authentication_cookie Boolean Whether to send the authentication cookie with the request.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success).
error_string String A human-readable result message.


Back To Top

photon_realtime_operation_join_random_or_create_room

Attempts to join a random room matching the criteria, creating a new room with the given options if none is found.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_join_random_or_create_room(room_name, options, custom_properties, random_options, expected_properties, callback=undefined)
Argument Type Description
room_name String The name to use if a room is created.
options PhotonRealtimeRoomOptions The room configuration used if a room is created.
custom_properties Struct Custom room properties as a GML struct (used on creation).
random_options PhotonRealtimeJoinRandomOptions The random-matchmaking options.
expected_properties Struct Custom properties a room must match, as a GML struct.
callback Function Optional callback invoked with the operation result.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The operation result code (Ok on success).
error_string String A human-readable result message.
room_name String The name of the room that was joined or created.
local_player_number Real The local player's actor number in the room.


Back To Top

photon_realtime_operation_get_room_list

Requests a room list from a specific SQL lobby.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_get_room_list(lobby_name, sql_filter, callback=undefined)
Argument Type Description
lobby_name String The lobby to query.
sql_filter String An SQL-style filter string.
callback Function Optional callback invoked with the room list.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
rooms Array of PhotonRealtimeRoomInfo The rooms that were added or updated.
removed Array of String The names of rooms that were removed.


Back To Top

photon_realtime_operation_lobby_stats

Requests lobby statistics for all tracked lobbies.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_lobby_stats(callback=undefined)
Argument Type Description
callback Function Optional callback invoked with the lobby stats.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
stats Array of PhotonRealtimeLobbyStats The statistics for each tracked lobby.


Back To Top

photon_realtime_operation_find_friends

Finds friends by user ID.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_find_friends(friends, callback=undefined)
Argument Type Description
friends Array of String An array of user IDs to look up.
callback Function Optional callback invoked with the friend info.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
friends Array of PhotonRealtimeFriendInfo The status of each requested friend.


Back To Top

photon_realtime_operation_web_rpc

Calls a WebRPC endpoint configured for your Photon application.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_operation_web_rpc(uri_path, callback=undefined)
Argument Type Description
uri_path String The WebRPC path to call.
callback Function Optional callback invoked with the response.

Returns:

Boolean

Whether the operation was sent.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code Real The operation result code.
error_string String A human-readable result message.
uri_path String The WebRPC path that was called.
result_code Real The result code returned by the WebRPC service.
response_data Struct The response data returned by the service, as a GML struct.


Back To Top

photon_realtime_operation_change_groups

Changes the interest groups this client receives events from. Pass the groups to remove and the groups to add; an empty or omitted array leaves that set unchanged.


Syntax:

photon_realtime_operation_change_groups(groups_to_remove=undefined, groups_to_add=undefined)
Argument Type Description
groups_to_remove Array of Real The interest groups to stop receiving.
groups_to_add Array of Real The interest groups to start receiving.

Returns:

Boolean

Whether the operation was sent.



Back To Top

photon_realtime_operation_custom_auth_next_step

Sends additional data for a multi-step custom authentication flow. Call this from inside the photon_realtime_set_callback_custom_authentication_step callback.


Syntax:

photon_realtime_operation_custom_auth_next_step(authentication)
Argument Type Description
authentication PhotonRealtimeAuthenticationValues The next-step authentication values.

Returns:

Boolean

Whether the operation was sent.



Back To Top

photon_realtime_operation_raise_event_string

Raises a custom event carrying a string payload to other players in the room. Receivers get it via photon_realtime_set_callback_custom_event.


Syntax:

photon_realtime_operation_raise_event_string(reliable, payload, event_code, options=undefined)
Argument Type Description
reliable Boolean Whether the event is sent reliably.
payload String The string payload to send.
event_code Real A custom event code identifying the event.
options PhotonRealtimeRaiseEventOptions Optional targeting and caching options.

Returns:

Boolean

Whether the event was raised.


Example:

photon_realtime_operation_raise_event_string(true, "hello", 1);


Back To Top

photon_realtime_operation_raise_event_buffer

Raises a custom event carrying a binary buffer payload to other players in the room. Receivers are notified via photon_realtime_set_callback_custom_event (with is_buffer set) and read the bytes with photon_realtime_receive_one_event_buffer.


Syntax:

photon_realtime_operation_raise_event_buffer(reliable, data, bytes, event_code, options=undefined)
Argument Type Description
reliable Boolean Whether the event is sent reliably.
data Buffer The buffer holding the payload.
bytes Real The number of bytes from the buffer to send.
event_code Real A custom event code identifying the event.
options PhotonRealtimeRaiseEventOptions Optional targeting and caching options.

Returns:

Boolean

Whether the event was raised.



Back To Top

photon_realtime_get_buffer_event_queue_count

Returns the number of buffered binary events waiting to be read from the queue.


Syntax:

photon_realtime_get_buffer_event_queue_count()

Returns:

Real

The number of queued buffer events.



Back To Top

photon_realtime_clear_buffer_event_queue

Clears all buffered binary events from the queue without reading them.


Syntax:

photon_realtime_clear_buffer_event_queue()

Returns:

Boolean

Whether the queue was cleared.



Back To Top

photon_realtime_peek_next_buffer_event_size

Returns the size in bytes of the next buffered binary event without removing it from the queue.


Syntax:

photon_realtime_peek_next_buffer_event_size()

Returns:

Real

The size of the next event in bytes.



Back To Top

photon_realtime_peek_next_buffer_event_code

Returns the event code of the next buffered binary event without removing it from the queue.


Syntax:

photon_realtime_peek_next_buffer_event_code()

Returns:

Real

The event code of the next event.



Back To Top

photon_realtime_receive_one_event_buffer

Removes the next buffered binary event from the queue and writes its payload into the given buffer.


Syntax:

photon_realtime_receive_one_event_buffer(out_data, max_bytes, offset)
Argument Type Description
out_data Buffer The buffer to write the payload into.
max_bytes Real The maximum number of bytes to write.
offset Real The offset within the buffer to start writing at.

Returns:

PhotonRealtimeEventBufferReceived

A struct describing the received event.


Example:

while (photon_realtime_get_buffer_event_queue_count() > 0) {
    var _size = photon_realtime_peek_next_buffer_event_size();
    var _buf = buffer_create(_size, buffer_grow, 1);
    var _info = photon_realtime_receive_one_event_buffer(_buf, _size, 0);
    if (_info.ok) {
        // read from _buf ... (event_code _info.event_code, from player _info.player_number)
    }
    buffer_delete(_buf);
}


Back To Top

photon_realtime_is_initialized

Returns whether the Realtime client has been initialised.


Syntax:

photon_realtime_is_initialized()

Returns:

Boolean

Whether the client is initialised.



Back To Top

photon_realtime_is_connected

Returns whether the client is currently connected to the Photon Cloud.


Syntax:

photon_realtime_is_connected()

Returns:

Boolean

Whether the client is connected.



Back To Top

photon_realtime_is_in_game_room

Returns whether the client is connected to a game server and inside a room.


Syntax:

photon_realtime_is_in_game_room()

Returns:

Boolean

Whether the client is in a game room.



Back To Top

photon_realtime_is_in_room

Returns whether the client is currently in a room.


Syntax:

photon_realtime_is_in_room()

Returns:

Boolean

Whether the client is in a room.



Back To Top

photon_realtime_is_in_lobby

Returns whether the client is currently in a matchmaking lobby.


Syntax:

photon_realtime_is_in_lobby()

Returns:

Boolean

Whether the client is in a lobby.



Back To Top

photon_realtime_get_current_room_name

Returns the name of the room the client is currently in, or an empty string if not in a room.


Syntax:

photon_realtime_get_current_room_name()

Returns:

String

The current room name.



Back To Top

photon_realtime_get_local_player_number

Returns the local player's actor number within the current room.


Syntax:

photon_realtime_get_local_player_number()

Returns:

Real

The local player number.



Back To Top

photon_realtime_get_server_time_offset

Returns the offset between local time and server time, in milliseconds.


Syntax:

photon_realtime_get_server_time_offset()

Returns:

Real

The server time offset in milliseconds.



Back To Top

photon_realtime_get_server_time

Returns the current server time in milliseconds.


Syntax:

photon_realtime_get_server_time()

Returns:

Real

The server time in milliseconds.



Back To Top

photon_realtime_get_bytes_in

Returns the total number of bytes received by the client.


Syntax:

photon_realtime_get_bytes_in()

Returns:

Real

The number of bytes received.



Back To Top

photon_realtime_get_bytes_out

Returns the total number of bytes sent by the client.


Syntax:

photon_realtime_get_bytes_out()

Returns:

Real

The number of bytes sent.



Back To Top

photon_realtime_get_state

Returns the current client state.


Syntax:

photon_realtime_get_state()

Returns:

PhotonRealtimeState

The current state.



Back To Top

photon_realtime_get_round_trip_time

Returns the current round-trip time to the server, in milliseconds.


Syntax:

photon_realtime_get_round_trip_time()

Returns:

Real

The round-trip time in milliseconds.



Back To Top

photon_realtime_get_round_trip_time_variance

Returns the variance of the round-trip time to the server, in milliseconds.


Syntax:

photon_realtime_get_round_trip_time_variance()

Returns:

Real

The round-trip time variance.



Back To Top

photon_realtime_get_disconnected_cause

Returns the cause of the most recent disconnect.


Syntax:

photon_realtime_get_disconnected_cause()

Returns:

PhotonRealtimeDisconnectCause

The disconnect cause.



Back To Top

photon_realtime_get_user_id

Returns the local player's user ID.


Syntax:

photon_realtime_get_user_id()

Returns:

String

The local user ID.



Back To Top

photon_realtime_get_count_players_ingame

Returns the number of players currently in games across the application. Available after connecting and while receiving app stats.


Syntax:

photon_realtime_get_count_players_ingame()

Returns:

Real

The number of players in games.



Back To Top

photon_realtime_get_count_games_running

Returns the number of games (rooms) currently running across the application.


Syntax:

photon_realtime_get_count_games_running()

Returns:

Real

The number of running games.



Back To Top

photon_realtime_get_count_players_online

Returns the total number of players currently online across the application.


Syntax:

photon_realtime_get_count_players_online()

Returns:

Real

The number of players online.



Back To Top

photon_realtime_get_master_server_address

Returns the address of the master server the client is using.


Syntax:

photon_realtime_get_master_server_address()

Returns:

String

The master server address.



Back To Top

photon_realtime_get_region

Returns the region token the client is currently connected to.


Syntax:

photon_realtime_get_region()

Returns:

String

The current region.



Back To Top

photon_realtime_get_region_with_best_ping

Returns the region with the best measured ping, available after the available-regions ping check completes.


Syntax:

photon_realtime_get_region_with_best_ping()

Returns:

String

The best-ping region token.



Back To Top

photon_realtime_get_friend_list_age

Returns the age in milliseconds of the last friend-list result from photon_realtime_operation_find_friends.


Syntax:

photon_realtime_get_friend_list_age()

Returns:

Real

The friend list age in milliseconds.



Back To Top

photon_realtime_get_disconnect_timeout

Returns the disconnect timeout in milliseconds.


Syntax:

photon_realtime_get_disconnect_timeout()

Returns:

Real

The disconnect timeout.



Back To Top

photon_realtime_set_disconnect_timeout

Sets the disconnect timeout: how long without a response before the client considers itself disconnected.


Syntax:

photon_realtime_set_disconnect_timeout(milliseconds)
Argument Type Description
milliseconds Real The timeout in milliseconds.

Returns:

Boolean

Whether the value was set.



Back To Top

photon_realtime_get_ping_interval

Returns the interval in milliseconds between pings sent to the server.


Syntax:

photon_realtime_get_ping_interval()

Returns:

Real

The ping interval.



Back To Top

photon_realtime_set_ping_interval

Sets the interval in milliseconds between pings sent to the server.


Syntax:

photon_realtime_set_ping_interval(milliseconds)
Argument Type Description
milliseconds Real The ping interval in milliseconds.

Returns:

Boolean

Whether the value was set.



Back To Top

photon_realtime_get_auto_join_lobby

Returns whether the client automatically joins the default lobby after connecting.


Syntax:

photon_realtime_get_auto_join_lobby()

Returns:

Boolean

Whether auto-join-lobby is enabled.



Back To Top

photon_realtime_set_auto_join_lobby

Sets whether the client automatically joins the default lobby after connecting.


Syntax:

photon_realtime_set_auto_join_lobby(enabled)
Argument Type Description
enabled Boolean Whether to auto-join the lobby.

Returns:

Boolean

Whether the value was set.



Back To Top

photon_realtime_get_room_player_count

Returns the number of players currently in the room.


Syntax:

photon_realtime_get_room_player_count()

Returns:

Real

The room player count.



Back To Top

photon_realtime_get_room_max_players

Returns the maximum number of players allowed in the current room.


Syntax:

photon_realtime_get_room_max_players()

Returns:

Real

The room's maximum players.



Back To Top

photon_realtime_get_room_is_open

Returns whether the current room is open to new players.


Syntax:

photon_realtime_get_room_is_open()

Returns:

Boolean

Whether the room is open.



Back To Top

photon_realtime_get_room_is_visible

Returns whether the current room is visible in the lobby room list.


Syntax:

photon_realtime_get_room_is_visible()

Returns:

Boolean

Whether the room is visible.



Back To Top

photon_realtime_get_master_client_number

Returns the player number of the current room's master client.


Syntax:

photon_realtime_get_master_client_number()

Returns:

Real

The master client's player number.



Back To Top

photon_realtime_set_master_client

Assigns the master client role to the given player. Only the current master client may do this.


Syntax:

photon_realtime_set_master_client(player_number)
Argument Type Description
player_number Real The player number to make master client.

Returns:

Boolean

Whether the request was sent.



Back To Top

photon_realtime_get_room_list_count

Returns the number of rooms in the most recent lobby room list.


Syntax:

photon_realtime_get_room_list_count()

Returns:

Real

The number of rooms.



Back To Top

photon_realtime_get_room_info_by_index

Returns information about a room in the lobby room list by index.


Syntax:

photon_realtime_get_room_info_by_index(index)
Argument Type Description
index Real The zero-based index into the room list.

Returns:

PhotonRealtimeRoomInfo

The room information.



Back To Top

photon_realtime_get_player_count

Returns the number of players currently tracked in the room.


Syntax:

photon_realtime_get_player_count()

Returns:

Real

The player count.



Back To Top

photon_realtime_get_player_number_by_index

Returns the player number at the given index in the room's player list.


Syntax:

photon_realtime_get_player_number_by_index(index)
Argument Type Description
index Real The zero-based index into the player list.

Returns:

Real

The player number.



Back To Top

photon_realtime_player_get_name

Returns the display name of the given player.


Syntax:

photon_realtime_player_get_name(player_number)
Argument Type Description
player_number Real The player number.

Returns:

String

The player's name.



Back To Top

photon_realtime_player_get_user_id

Returns the user ID of the given player.


Syntax:

photon_realtime_player_get_user_id(player_number)
Argument Type Description
player_number Real The player number.

Returns:

String

The player's user ID.



Back To Top

photon_realtime_player_is_inactive

Returns whether the given player is currently inactive (has left but may rejoin).


Syntax:

photon_realtime_player_is_inactive(player_number)
Argument Type Description
player_number Real The player number.

Returns:

Boolean

Whether the player is inactive.



Back To Top

photon_realtime_player_is_master_client

Returns whether the given player is the room's master client.


Syntax:

photon_realtime_player_is_master_client(player_number)
Argument Type Description
player_number Real The player number.

Returns:

Boolean

Whether the player is the master client.



Back To Top

photon_realtime_get_player_numbers

Returns an array of the player numbers currently in the room.


Syntax:

photon_realtime_get_player_numbers()

Returns:

Array of Real

An array of player numbers.



Back To Top

photon_realtime_set_callback_debug

Registers the callback fired with SDK debug output.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_debug(callback)
Argument Type Description
callback Function The function to call with debug output.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
debug_level Real The debug level of the message.
message String The debug message.


Back To Top

photon_realtime_set_callback_connected

Registers the callback fired when the client finishes connecting.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_connected(callback)
Argument Type Description
callback Function The function to call on connect.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code PhotonRealtimeAppErrorCode The connect result code (Ok on success).
error_string String A human-readable result message.
region String The region that was connected to.


Back To Top

photon_realtime_set_callback_disconnected

Registers the callback fired when the client has disconnected. The callback takes no arguments.


Syntax:

photon_realtime_set_callback_disconnected(callback)
Argument Type Description
callback Function The function to call on disconnect.

Returns:

Boolean

Whether the callback was set.



Back To Top

photon_realtime_set_callback_connection_error

Registers the callback fired on a low-level connection error.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_connection_error(callback)
Argument Type Description
callback Function The function to call on a connection error.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code Real The connection error code.


Back To Top

photon_realtime_set_callback_client_error

Registers the callback fired on a client-side error.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_client_error(callback)
Argument Type Description
callback Function The function to call on a client error.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code Real The client error code.


Back To Top

photon_realtime_set_callback_server_error

Registers the callback fired on a server-reported error.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_server_error(callback)
Argument Type Description
callback Function The function to call on a server error.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
error_code Real The server error code.


Back To Top

photon_realtime_set_callback_warning

Registers the callback fired on a client warning.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_warning(callback)
Argument Type Description
callback Function The function to call on a warning.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
warning_code Real The warning code.


Back To Top

photon_realtime_set_callback_join_room_event

Registers the callback fired when a player joins the room. When the local client joins, it fires once per player already present.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_join_room_event(callback)
Argument Type Description
callback Function The function to call on a join event.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
joining_player_number Real The player number that triggered the join.
player_number Real The player number described by this call.
player_name String The player's display name.
user_id String The player's user ID.
is_inactive Boolean Whether the player is inactive.
is_master_client Boolean Whether the player is the master client.


Back To Top

photon_realtime_set_callback_leave_room_event

Registers the callback fired when a player leaves the room.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_leave_room_event(callback)
Argument Type Description
callback Function The function to call on a leave event.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
player_number Real The player number that left.
is_inactive Boolean Whether the player became inactive (may rejoin) rather than leaving for good.


Back To Top

photon_realtime_set_callback_custom_event

Registers the callback fired when a custom event raised by photon_realtime_operation_raise_event_string or photon_realtime_operation_raise_event_buffer is received.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_custom_event(callback)
Argument Type Description
callback Function The function to call on a custom event.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
player_number Real The sender's player number.
event_code Real The custom event code.
payload String The string payload; empty for buffer events (read the bytes with photon_realtime_receive_one_event_buffer).
is_buffer Boolean Whether the event carries a binary buffer payload.


Back To Top

photon_realtime_set_callback_room_properties_change

Registers the callback fired when the room's custom properties change. See Realtime Room Properties.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_room_properties_change(callback)
Argument Type Description
callback Function The function to call on a room-properties change.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
properties Struct The changed properties, as a GML struct.


Back To Top

photon_realtime_set_callback_player_properties_change

Registers the callback fired when a player's custom properties change. See Realtime Player Properties.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_player_properties_change(callback)
Argument Type Description
callback Function The function to call on a player-properties change.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
player_number Real The player whose properties changed.
properties Struct The changed properties, as a GML struct.


Back To Top

photon_realtime_set_callback_room_list_update

Registers the callback fired when the lobby room list updates. The callback takes no arguments; read the updated list with photon_realtime_get_room_list_count and photon_realtime_get_room_info_by_index.


Syntax:

photon_realtime_set_callback_room_list_update(callback)
Argument Type Description
callback Function The function to call on a room-list update.

Returns:

Boolean

Whether the callback was set.



Back To Top

photon_realtime_set_callback_app_stats_update

Registers the callback fired when application statistics update. The callback takes no arguments; read the values with photon_realtime_get_count_players_online, photon_realtime_get_count_players_ingame and photon_realtime_get_count_games_running.


Syntax:

photon_realtime_set_callback_app_stats_update(callback)
Argument Type Description
callback Function The function to call on an app-stats update.

Returns:

Boolean

Whether the callback was set.



Back To Top

photon_realtime_set_callback_lobby_stats_update

Registers the callback fired with lobby statistics updates.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_lobby_stats_update(callback)
Argument Type Description
callback Function The function to call on a lobby-stats update.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
stats Array of PhotonRealtimeLobbyStats The statistics for each tracked lobby.


Back To Top

photon_realtime_set_callback_cache_slice_changed

Registers the callback fired when the active event-cache slice index changes.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_cache_slice_changed(callback)
Argument Type Description
callback Function The function to call on a cache-slice change.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
cache_slice_index Real The new active cache slice index.


Back To Top

photon_realtime_set_callback_master_client_changed

Registers the callback fired when the room's master client changes.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_master_client_changed(callback)
Argument Type Description
callback Function The function to call on a master-client change.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
player_number Real The player number of the new master client.
old_player_number Real The player number of the previous master client.


Back To Top

photon_realtime_set_callback_properties_change_failed

Registers the callback fired when a properties change (for example a compare-and-swap) is rejected by the server. The callback takes no arguments.


Syntax:

photon_realtime_set_callback_properties_change_failed(callback)
Argument Type Description
callback Function The function to call on a failed properties change.

Returns:

Boolean

Whether the callback was set.



Back To Top

photon_realtime_set_callback_custom_authentication_step

Registers the callback fired during a multi-step custom authentication flow. Respond with photon_realtime_operation_custom_auth_next_step.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_custom_authentication_step(callback)
Argument Type Description
callback Function The function to call for each authentication step.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
response_data Struct The intermediate authentication response data, as a GML struct.


Back To Top

photon_realtime_set_callback_available_regions

Registers the callback fired when the list of available regions arrives. Use it to pick a region with photon_realtime_select_region.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_available_regions(callback)
Argument Type Description
callback Function The function to call with the available regions.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
regions Array of String The available region tokens.
servers Array of String The server address for each region.


Back To Top

photon_realtime_set_callback_secret_receival

Registers the callback fired when the client receives an authentication secret from the server.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_secret_receival(callback)
Argument Type Description
callback Function The function to call on secret receival.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
secret String The authentication secret.


Back To Top

photon_realtime_set_callback_direct_connection_established

Registers the callback fired when a direct (peer-to-peer) connection to another player is established.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_direct_connection_established(callback)
Argument Type Description
callback Function The function to call when a direct connection is established.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
remote_peer_id Real The peer ID of the remote player.


Back To Top

photon_realtime_set_callback_direct_connection_failed

Registers the callback fired when a direct (peer-to-peer) connection attempt fails.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_direct_connection_failed(callback)
Argument Type Description
callback Function The function to call when a direct connection fails.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
remote_peer_id Real The peer ID of the remote player.


Back To Top

photon_realtime_set_callback_direct_message

Registers the callback fired when a message arrives over a direct (peer-to-peer) connection.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_direct_message(callback)
Argument Type Description
callback Function The function to call on a direct message.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
remote_peer_id Real The peer ID of the sender.
relay_fallback Boolean Whether the message was relayed through the server rather than sent directly.
message String The message payload.


Back To Top

photon_realtime_set_callback_custom_operation_response

Registers the callback fired with the response to a custom operation.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

photon_realtime_set_callback_custom_operation_response(callback)
Argument Type Description
callback Function The function to call on a custom operation response.

Returns:

Boolean

Whether the callback was set.


Triggers:

Callback

The callback is invoked with the following arguments:

Key Type Description
operation_code Real The operation code the response is for.
return_code Real The server's return code.
debug_message String A human-readable debug message.
parameters Struct The response parameters, as a GML struct.


Back To Top

photon_realtime_remove_callback_debug

Removes the debug callback registered with photon_realtime_set_callback_debug.


Syntax:

photon_realtime_remove_callback_debug()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_connected

Removes the connected callback registered with photon_realtime_set_callback_connected.


Syntax:

photon_realtime_remove_callback_connected()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_disconnected

Removes the disconnected callback registered with photon_realtime_set_callback_disconnected.


Syntax:

photon_realtime_remove_callback_disconnected()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_connection_error

Removes the connection-error callback registered with photon_realtime_set_callback_connection_error.


Syntax:

photon_realtime_remove_callback_connection_error()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_client_error

Removes the client-error callback registered with photon_realtime_set_callback_client_error.


Syntax:

photon_realtime_remove_callback_client_error()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_server_error

Removes the server-error callback registered with photon_realtime_set_callback_server_error.


Syntax:

photon_realtime_remove_callback_server_error()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_warning

Removes the warning callback registered with photon_realtime_set_callback_warning.


Syntax:

photon_realtime_remove_callback_warning()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_join_room_event

Removes the join-room callback registered with photon_realtime_set_callback_join_room_event.


Syntax:

photon_realtime_remove_callback_join_room_event()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_leave_room_event

Removes the leave-room callback registered with photon_realtime_set_callback_leave_room_event.


Syntax:

photon_realtime_remove_callback_leave_room_event()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_custom_event

Removes the custom-event callback registered with photon_realtime_set_callback_custom_event.


Syntax:

photon_realtime_remove_callback_custom_event()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_room_properties_change

Removes the room-properties-change callback registered with photon_realtime_set_callback_room_properties_change.


Syntax:

photon_realtime_remove_callback_room_properties_change()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_player_properties_change

Removes the player-properties-change callback registered with photon_realtime_set_callback_player_properties_change.


Syntax:

photon_realtime_remove_callback_player_properties_change()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_room_list_update

Removes the room-list-update callback registered with photon_realtime_set_callback_room_list_update.


Syntax:

photon_realtime_remove_callback_room_list_update()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_app_stats_update

Removes the app-stats-update callback registered with photon_realtime_set_callback_app_stats_update.


Syntax:

photon_realtime_remove_callback_app_stats_update()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_lobby_stats_update

Removes the lobby-stats-update callback registered with photon_realtime_set_callback_lobby_stats_update.


Syntax:

photon_realtime_remove_callback_lobby_stats_update()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_cache_slice_changed

Removes the cache-slice-changed callback registered with photon_realtime_set_callback_cache_slice_changed.


Syntax:

photon_realtime_remove_callback_cache_slice_changed()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_master_client_changed

Removes the master-client-changed callback registered with photon_realtime_set_callback_master_client_changed.


Syntax:

photon_realtime_remove_callback_master_client_changed()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_properties_change_failed

Removes the properties-change-failed callback registered with photon_realtime_set_callback_properties_change_failed.


Syntax:

photon_realtime_remove_callback_properties_change_failed()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_custom_authentication_step

Removes the custom-authentication-step callback registered with photon_realtime_set_callback_custom_authentication_step.


Syntax:

photon_realtime_remove_callback_custom_authentication_step()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_available_regions

Removes the available-regions callback registered with photon_realtime_set_callback_available_regions.


Syntax:

photon_realtime_remove_callback_available_regions()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_secret_receival

Removes the secret-receival callback registered with photon_realtime_set_callback_secret_receival.


Syntax:

photon_realtime_remove_callback_secret_receival()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_direct_connection_established

Removes the direct-connection-established callback registered with photon_realtime_set_callback_direct_connection_established.


Syntax:

photon_realtime_remove_callback_direct_connection_established()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_direct_connection_failed

Removes the direct-connection-failed callback registered with photon_realtime_set_callback_direct_connection_failed.


Syntax:

photon_realtime_remove_callback_direct_connection_failed()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_direct_message

Removes the direct-message callback registered with photon_realtime_set_callback_direct_message.


Syntax:

photon_realtime_remove_callback_direct_message()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_remove_callback_custom_operation_response

Removes the custom-operation-response callback registered with photon_realtime_set_callback_custom_operation_response.


Syntax:

photon_realtime_remove_callback_custom_operation_response()

Returns:

Boolean

Whether the callback was removed.



Back To Top

photon_realtime_peek_next_buffer_event_player_number

Returns the sender's player number for the next buffered binary event without removing it from the queue.


Syntax:

photon_realtime_peek_next_buffer_event_player_number()

Returns:

Real

The player number of the next event's sender.



Back To Top

PhotonRealtimeState

The states the Realtime client moves through, returned by photon_realtime_get_state.

These constants are referenced by the following functions:


Member Description
Unknown Unknown state.
Uninitialized The client has not been initialised.
PeerCreated The peer has been created but is not connecting.
ConnectingToNameserver Connecting to the name server.
ConnectedToNameserver Connected to the name server.
DisconnectingFromNameserver Disconnecting from the name server.
Connecting Connecting to the master server.
Connected Connected to the master server.
WaitingForCustomAuthNextStep Waiting on the next custom authentication step.
Authenticated Authenticated on the master server.
JoinedLobby Joined a matchmaking lobby.
DisconnectingFromMasterserver Disconnecting from the master server.
ConnectingToGameserver Connecting to a game server.
ConnectedToGameserver Connected to a game server.
AuthenticatedOnGameServer Authenticated on the game server.
Joining Joining a room.
Joined Joined a room.
Leaving Leaving a room.
Left Left a room.
DisconnectingFromGameserver Disconnecting from the game server.
ConnectingToMasterserver Connecting back to the master server.
ConnectedComingFromGameserver Connected to the master server after leaving a game server.
AuthenticatedComingFromGameserver Authenticated on the master server after leaving a game server.
Disconnecting Disconnecting.
Disconnected Fully disconnected.


Back To Top

PhotonRealtimeLobbyType

The types of matchmaking lobby.

These constants are referenced by the following functions:

These constants are referenced by the following structs:


Member Description
Default The default lobby.
SqlLobby An SQL-filterable lobby.
AsyncRandomLobby An asynchronous random-matchmaking lobby.


Back To Top

PhotonRealtimeMatchmakingMode

How rooms are filled during random matchmaking.

These constants are referenced by the following structs:


Member Description
FillRoom Fill rooms to capacity before starting new ones.
SerialMatching Match rooms serially.
RandomMatching Match into a random room.


Back To Top

PhotonRealtimeDirectMode

The direct (peer-to-peer) connection modes.


Member Description
None No direct connections.
AllToOthers Every client connects directly to every other.
MasterToOthers The master client connects directly to the others.
AllToAll All clients connect directly to all clients.
MasterToAll The master client connects directly to all clients.


Back To Top

PhotonRealtimeDisconnectCause

The reasons a client can be disconnected, returned by photon_realtime_get_disconnected_cause.

These constants are referenced by the following functions:


Member Description
Unknown Unknown cause.
None No disconnect.
ServerUserLimit The server's user limit was reached.
ExceptionOnConnect An exception occurred while connecting.
DisconnectByServer The server closed the connection.
DisconnectByServerLogic Server-side logic closed the connection.
TimeoutDisconnect The connection timed out.
Exception A client-side exception occurred.
InvalidAuthentication Authentication was invalid.
MaxCcuReached The application's maximum concurrent-user limit was reached.
InvalidRegion The requested region was invalid.
OperationNotAllowed An operation was not allowed in the current state.
CustomAuthenticationFailed Custom authentication failed.
ClientVersionTooOld The client version is too old.
ClientVersionInvalid The client version is invalid.
DashboardVersionInvalid The dashboard-configured version is invalid.
AuthenticationTicketExpired The authentication ticket expired.
OperationLimit An operation limit was exceeded.


Back To Top

PhotonRealtimeRegionSelectionMode

How the connection region is selected.


Member Description
Default Use the default region behaviour.
Select Use an explicitly selected region.
Best Use the region with the best ping.


Back To Top

PhotonRealtimeServerType

The Photon server types.


Member Description
NameServer The name server.
MasterServer The master server.


Back To Top

PhotonRealtimeCustomAuthType

The custom authentication providers supported by Photon.

These constants are referenced by the following structs:


Member Description
Custom A custom authentication service.
Steam Steam authentication.
Facebook Facebook authentication.
Oculus Oculus authentication.
PlayStation4 PlayStation 4 authentication.
Xbox Xbox authentication.
Viveport Viveport authentication.
NintendoSwitch Nintendo Switch authentication.
PlayStation5 PlayStation 5 authentication.
Epic Epic authentication.
FacebookGaming Facebook Gaming authentication.
None No custom authentication.


Back To Top

PhotonRealtimeReceiverGroup

Which players receive a raised event.

These constants are referenced by the following structs:


Member Description
Others All players except the sender.
All All players including the sender.
MasterClient Only the room's master client.


Back To Top

PhotonRealtimeEventCache

How a raised event is cached on the server.

These constants are referenced by the following structs:


Member Description
DoNotCache Do not cache the event.
MergeCache Merge the event into the cache.
ReplaceCache Replace the cached event.
RemoveCache Remove the event from the cache.
AddToRoomCache Add the event to the room cache.
AddToRoomCacheGlobal Add the event to the global room cache.
RemoveFromRoomCache Remove the event from the room cache.
RemoveFromRoomCacheForActorsLeft Remove cached events for actors that have left.
SliceIncIndex Increment the cache slice index.
SliceSetIndex Set the cache slice index.
SlicePurgeIndex Purge a specific cache slice.
SlicePurgeUpToIndex Purge cache slices up to an index.


Back To Top

PhotonRealtimeLBOperationCode

The LoadBalancing operation codes. Primarily useful when interpreting custom operation responses.


Member Description
Leave Leave a room.
RaiseEvent Raise an event.
SetProperties Set properties.
GetProperties Get properties.
ChangeGroups Change interest groups.
AuthOnce Authenticate once.
Authenticate Authenticate.
JoinLobby Join a lobby.
LeaveLobby Leave a lobby.
CreateRoom Create a room.
JoinRoom Join a room.
JoinRandomRoom Join a random room.
FindFriends Find friends.
LobbyStats Request lobby stats.
GetRegions Get available regions.
Rpc Call a WebRPC.
GetRoomList Get a room list.


Back To Top

PhotonRealtimeLBEventCode

The LoadBalancing event codes. Primarily useful when interpreting incoming events.


Member Description
Join A player joined.
Leave A player left.
PropertiesChanged Properties changed.
ErrorInfo Error information from the server.
CacheSliceChanged The cache slice changed.
RoomList A room list was received.
RoomListUpdate A room list update was received.
AppStats Application statistics were received.
LobbyStats Lobby statistics were received.
Auth An authentication event.
PunchMsg A NAT-punchthrough message.
VoiceFrameData Voice frame data.
VoiceData Voice data.
MaxCustomEvCode The highest reserved event code; custom codes must stay below it.


Back To Top

PhotonRealtimeAppErrorCode

Application-level result codes reported by operations and the connected callback.

These constants are referenced by the following functions:


Member Description
Ok The operation succeeded.
InvalidAuthentication Authentication was invalid.
GameIdAlreadyExists A room with that name already exists.
GameFull The room is full.
GameClosed The room is closed.
AlreadyMatched The client is already matched.
ServerFull The server is full.
UserBlocked The user is blocked.
NoMatchFound No matching room was found.
GameDoesNotExist The room does not exist.
MaxCcuReached The maximum concurrent-user limit was reached.
InvalidRegion The region was invalid.
CustomAuthenticationFailed Custom authentication failed.
AuthTicketExpired The authentication ticket expired.
PluginReportedError A server plugin reported an error.
PluginMismatch A server plugin mismatch occurred.
JoinFailedPeerAlreadyJoined Join failed: the peer already joined.
JoinFailedFoundInactiveJoiner Join failed: an inactive joiner was found.
JoinFailedRejoinNotFound Join failed: no actor to rejoin was found.
JoinFailedFoundExcludedUserId Join failed: the user ID is excluded.
JoinFailedFoundActiveJoiner Join failed: an active joiner was found.
HttpLimitReached The HTTP request limit was reached.
ExternalHttpCallFailed An external HTTP call failed.
OperationLimitReached An operation limit was reached.
SlotError A slot-reservation error occurred.
InvalidEncryptionParameters The encryption parameters were invalid.
ClientVersionTooOld The client version is too old.
ClientVersionInvalid The client version is invalid.
DashboardVersionInvalid The dashboard-configured version is invalid.


Back To Top

PhotonRealtimeEventBufferReceived

Describes a binary event read with photon_realtime_receive_one_event_buffer.

This struct is referenced by the following functions:


Member Type Description
ok Boolean Whether an event was successfully read.
player_number Real The sender's player number.
event_code Real The event's custom event code.
bytes_written Real The number of bytes written into the output buffer.


Back To Top

PhotonRealtimeJoinRandomOptions

Options describing random-room matchmaking.

This struct is referenced by the following functions:


Member Type Description
max_players Real Only match rooms with this maximum player count.
matchmaking_mode PhotonRealtimeMatchmakingMode How rooms are filled during matchmaking.
lobby_name String The lobby to match within.
lobby_type PhotonRealtimeLobbyType The type of lobby to match within.
sql_filter String An SQL-style filter applied when using an SQL lobby.
expected_users Array of String User IDs reserved a slot in the matched room.


Back To Top

PhotonRealtimeRoomOptions

Options describing a room to create.

This struct is referenced by the following functions:


Member Type Description
max_players Real Maximum number of players allowed in the room (0 for unlimited).
is_visible Boolean Whether the room is listed in the lobby.
is_open Boolean Whether the room accepts new players.
lobby_name String The lobby the room belongs to.
lobby_type PhotonRealtimeLobbyType The type of the room's lobby.
player_ttl Real How long (ms) an inactive player is kept before being removed.
empty_room_ttl Real How long (ms) an empty room is kept alive before being removed.
suppress_room_events Boolean Whether to suppress join/leave events for the room.
publish_user_id Boolean Whether player user IDs are visible to others in the room.
lobby_keys Array of String The custom-property keys exposed to the lobby for matchmaking.
expected_users Array of String User IDs reserved a slot in the room.


Back To Top

PhotonRealtimeJoinRoomOptions

Options passed to photon_realtime_operation_join_room.

This struct is referenced by the following functions:


Member Type Description
rejoin Boolean Whether to rejoin as a previously-inactive actor.
cache_slice_index Real The event-cache slice index to fetch on join.


Back To Top

PhotonRealtimeRaiseEventOptions

Targeting and caching options for raised events.

This struct is referenced by the following functions:


Member Type Description
receiver_group PhotonRealtimeReceiverGroup Which group of players receives the event.
interest_group Real The interest group the event belongs to.
event_cache PhotonRealtimeEventCache How the event is cached on the server.
channel_id Real The sequencing channel to send on.
cache_slice_index Real The cache slice index to target.
encrypt Boolean Whether to encrypt the event payload.
target_players Array of Real Target specific player numbers. An empty array broadcasts to receiver_group (default: Others).


Back To Top

PhotonRealtimeAuthenticationValues

Authentication values for a custom authentication provider.

This struct is referenced by the following functions:

This struct is referenced by the following structs:


Member Type Description
user_id String Unique identifier for this player. Used by Photon for matchmaking and friend lookup.
auth_type PhotonRealtimeCustomAuthType Authentication provider. Defaults to PhotonRealtimeCustomAuthType.None.
parameters String Token/parameters string passed to the authentication provider.


Back To Top

PhotonRealtimeFriendInfo

A friend-status entry delivered by photon_realtime_operation_find_friends.

This struct is referenced by the following functions:


Member Type Description
user_id String The friend's user ID.
is_online Boolean Whether the friend is currently online.
room String The room the friend is in, if any.
is_in_room Boolean Whether the friend is currently in a room.


Back To Top

PhotonRealtimeRoomInfo

A snapshot of a single room in the lobby room list.

This struct is referenced by the following functions:


Member Type Description
name String The room's name.
player_count Real The current number of players in the room.
max_players Real The room's maximum player count.
is_open Boolean Whether the room is open to new players.
custom_properties Struct The room's lobby-exposed custom properties, as a GML struct.


Back To Top

PhotonRealtimeLobbyStats

A statistics entry for a single lobby, delivered by photon_realtime_operation_lobby_stats and the lobby-stats-update callback.

This struct is referenced by the following functions:


Member Type Description
name String The lobby's name.
type PhotonRealtimeLobbyType The lobby's type.
peer_count Real The number of players in the lobby.
room_count Real The number of rooms in the lobby.


Back To Top

PhotonRealtimeConnectOptions

Options passed to photon_realtime_connect.

This struct is referenced by the following functions:


Member Type Description
authentication_values PhotonRealtimeAuthenticationValues Authentication values for a custom auth provider.
username String Display name visible to other players. Separate from the user_id in authentication_values.
server_address String Override the Photon name server address. Leave unset to use the default cloud.
try_use_datagram_encryption Boolean Whether to attempt datagram encryption for the connection.
use_background_thread Boolean Whether to use a background send/receive thread. Honored only on Nintendo Switch; ignored on other platforms.


Clone this wiki locally