Skip to content

realtime_room_properties

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

Realtime Room Properties

Room custom properties are shared key/value data attached to the current room and synced to all players. Any player can set them (subject to the room's rules), read them, and use compare-and-swap for safe concurrent updates. Changes are delivered to photon_realtime_set_callback_room_properties_change.

Set & remove

Set or remove room custom properties:

Query & get

Read room custom properties:

Compare-and-swap

Atomically update a property only if it still holds an expected value:



Back To Top

photon_realtime_room_properties_set_string

Sets a string custom property on the current room and syncs it to everyone. Other clients are notified via photon_realtime_set_callback_room_properties_change.


Syntax:

photon_realtime_room_properties_set_string(key, value)
Argument Type Description
key String The property key.
value String The string value to set.

Returns:

Boolean

Whether the property was set.



Back To Top

photon_realtime_room_properties_set_i32

Sets a 32-bit integer custom property on the current room and syncs it to everyone.


Syntax:

photon_realtime_room_properties_set_i32(key, value)
Argument Type Description
key String The property key.
value Real The integer value to set.

Returns:

Boolean

Whether the property was set.



Back To Top

photon_realtime_room_properties_set_f64

Sets a 64-bit floating point custom property on the current room and syncs it to everyone.


Syntax:

photon_realtime_room_properties_set_f64(key, value)
Argument Type Description
key String The property key.
value Real The value to set.

Returns:

Boolean

Whether the property was set.



Back To Top

photon_realtime_room_properties_set_bool

Sets a boolean custom property on the current room and syncs it to everyone.


Syntax:

photon_realtime_room_properties_set_bool(key, value)
Argument Type Description
key String The property key.
value Boolean The value to set.

Returns:

Boolean

Whether the property was set.



Back To Top

photon_realtime_room_properties_remove

Removes a custom property from the current room.


Syntax:

photon_realtime_room_properties_remove(key)
Argument Type Description
key String The property key to remove.

Returns:

Boolean

Whether the property was removed.



Back To Top

photon_realtime_room_properties_clear

Removes all custom properties from the current room.


Syntax:

photon_realtime_room_properties_clear()

Returns:

Boolean

Whether the properties were cleared.



Back To Top

photon_realtime_room_properties_has

Returns whether the current room has a custom property with the given key.


Syntax:

photon_realtime_room_properties_has(key)
Argument Type Description
key String The property key.

Returns:

Boolean

Whether the property exists.



Back To Top

photon_realtime_room_properties_get_string

Returns a string custom property of the current room.


Syntax:

photon_realtime_room_properties_get_string(key)
Argument Type Description
key String The property key.

Returns:

String

The property value.



Back To Top

photon_realtime_room_properties_get_i32

Returns an integer custom property of the current room.


Syntax:

photon_realtime_room_properties_get_i32(key)
Argument Type Description
key String The property key.

Returns:

Real

The property value.



Back To Top

photon_realtime_room_properties_get_f64

Returns a floating point custom property of the current room.


Syntax:

photon_realtime_room_properties_get_f64(key)
Argument Type Description
key String The property key.

Returns:

Real

The property value.



Back To Top

photon_realtime_room_properties_get_bool

Returns a boolean custom property of the current room.


Syntax:

photon_realtime_room_properties_get_bool(key)
Argument Type Description
key String The property key.

Returns:

Boolean

The property value.



Back To Top

photon_realtime_room_properties_to_string

Returns a human-readable string of all the room's custom properties, useful for debugging.


Syntax:

photon_realtime_room_properties_to_string()

Returns:

String

A readable dump of the room properties.



Back To Top

photon_realtime_room_properties_get_all

Returns all of the room's custom properties as a GML struct.


Syntax:

photon_realtime_room_properties_get_all()

Returns:

Struct

A struct of all room custom properties.



Back To Top

photon_realtime_room_properties_cas_string

Atomically sets a string room property only if its current value equals the expected value (compare-and-swap). If the check fails on the server, photon_realtime_set_callback_properties_change_failed fires. Returns false immediately if not in a room.


Syntax:

photon_realtime_room_properties_cas_string(key, expected_value, new_value)
Argument Type Description
key String The property key.
expected_value String The value the property must currently have.
new_value String The value to set if the check passes.

Returns:

Boolean

Whether the request was sent.



Back To Top

photon_realtime_room_properties_cas_i32

Atomically sets an integer room property only if its current value equals the expected value (compare-and-swap). If the check fails on the server, photon_realtime_set_callback_properties_change_failed fires. Returns false immediately if not in a room.


Syntax:

photon_realtime_room_properties_cas_i32(key, expected_value, new_value)
Argument Type Description
key String The property key.
expected_value Real The value the property must currently have.
new_value Real The value to set if the check passes.

Returns:

Boolean

Whether the request was sent.



Back To Top

photon_realtime_room_properties_cas_f64

Atomically sets a floating point room property only if its current value equals the expected value (compare-and-swap). If the check fails on the server, photon_realtime_set_callback_properties_change_failed fires. Returns false immediately if not in a room.


Syntax:

photon_realtime_room_properties_cas_f64(key, expected_value, new_value)
Argument Type Description
key String The property key.
expected_value Real The value the property must currently have.
new_value Real The value to set if the check passes.

Returns:

Boolean

Whether the request was sent.



Back To Top

photon_realtime_room_properties_cas_bool

Atomically sets a boolean room property only if its current value equals the expected value (compare-and-swap). If the check fails on the server, photon_realtime_set_callback_properties_change_failed fires. Returns false immediately if not in a room.


Syntax:

photon_realtime_room_properties_cas_bool(key, expected_value, new_value)
Argument Type Description
key String The property key.
expected_value Boolean The value the property must currently have.
new_value Boolean The value to set if the check passes.

Returns:

Boolean

Whether the request was sent.



Clone this wiki locally