Class: Room

Photon.LoadBalancing.Room(name)

Represents a room client joins or is joined to. Extend to implement custom logic. Custom properties can be set via setCustomProperty() while being in the room.

Constructor

new Room(name)

Parameters:
Name Type Description
name string Room name.
Mixes In:

Methods

clearExpectedUsers()

Attempts to remove all current expected users from the server's Slot Reservation list. Note that this operation can conflict with new/other users joining. They might be adding users to the list of expected users before or after this client called ClearExpectedUsers. This room's expectedUsers value will update, when the server sends a successful update. Internals: This methods wraps up setting the ExpectedUsers property of a room.

setCustomProperties(properties, webForwardopt, expectedPropertiesopt)

Sets custom property

Parameters:
Name Type Attributes Default Description
properties object Table of properties to set.
webForward boolean <optional>
false Forward to web hook.
expectedProperties object <optional>
Table of properties expected when update occurs. Use null as value if you expect the property to not exist. (CAS : "Check And Swap")

setCustomProperty(name, value, webForwardopt, expectedValueopt)

Sets custom property

Parameters:
Name Type Attributes Default Description
name string Name of the property.
value object Property value.
webForward boolean <optional>
false Forward to web hook.
expectedValue object <optional>
Property value expected when update occurs. (CAS : "Check And Swap")

setIsOpen(isOpen)

Sets if this room can be joined.

Parameters:
Name Type Description
isOpen boolean New property value.

setIsVisible(isVisible)

Sets rooms visibility in the lobby's room list.

Parameters:
Name Type Description
isVisible boolean New visibility value.

setMasterClient(actorNr)

Asks the server to assign another player as Master Client of your current room. This method calls an operation on the server to set a new Master Client, which takes a roundtrip. In case of success, this client and the others get the new Master Client from the server.

Parameters:
Name Type Description
actorNr number New Master Client actor ID.

setMaxPlayers(maxPlayers)

Sets max players before room is considered full.

Parameters:
Name Type Description
maxPlayers number New max players value.

setPlayerTTL(ttl)

Sets player Time To Live indicating how long suspended player will be kept in the room.

Parameters:
Name Type Description
ttl number New Time To Live value in ms.

setPlugins(plugins)

Sets expected server plugins.

Parameters:
Name Type Description
plugins Array.<string> New plugins list.

setPropsListedInLobby(props)

Sets list of the room properties to pass to the RoomInfo list in a lobby.

Parameters:
Name Type Description
props Array.<string> Array of properties names.

setPropsListedInLobby(props)

Sets list of the room properties to pass to the RoomInfo list in a lobby.

Parameters:
Name Type Description
props Array.<string> Array of properties names.

setRoomTTL(ttl)

Sets room Time To Live in the server room cache after all clients have left the room.

Parameters:
Name Type Description
ttl number New Time To Live value in ms.