Packagecom.smartfoxserver.v2.entities
Interfacepublic interface Room
Implementors SFSRoom

The Room interface defines all the methods and properties that an object representing a SmartFoxServer Room entity exposes.

In the SmartFoxServer 2X client API this interface is implemented by the SFSRoom class. Read the class description for additional informations.

See also

SFSRoom


Public Properties
 PropertyDefined By
  capacity : int
[read-only] Returns the maximum amount of users, including spectators, that can be contained in this Room.
Room
  groupId : String
[read-only] Returns the Room Group name.
Room
  id : int
[read-only] Indicates the id of this Room.
Room
  isGame : Boolean
Indicates whether this is a Game Room or not.
Room
  isHidden : Boolean
Indicates whether this Room is hidden or not.
Room
  isJoined : Boolean
Indicates whether the client joined this Room or not.
Room
  isPasswordProtected : Boolean
Indicates whether this Room requires a password to be joined or not.
Room
  maxSpectators : int
Returns the maximum number of spectators allowed in this Room (Game Rooms only).
Room
  maxUsers : int
Returns the maximum number of users allowed in this Room.
Room
  name : String
Indicates the name of this Room.
Room
  playerList : Array
[read-only] Returns a list of User objects representing the players currently inside this Room (Game Rooms only).
Room
  properties : Object
Defines a generic utility object that can be used to store custom Room data.
Room
  roomManager : IRoomManager
Returns a reference to the Room Manager which manages this Room.
Room
  spectatorCount : int
Returns the current number of spectators in this Room (Game Rooms only).
Room
  spectatorList : Array
[read-only] Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).
Room
  userCount : int
Returns the current number of users in this Room.
Room
  userList : Array
[read-only] Returns a list of User objects representing all the users currently inside this Room.
Room
Public Methods
 MethodDefined By
  
containsUser(user:User):Boolean
Indicates whether the specified user is currently inside this Room or not.
Room
  
containsVariable(name:String):Boolean
Indicates whether this Room has the specified Room Variable set or not.
Room
  
Retrieves a User object from its id property.
Room
  
getUserByName(name:String):User
Retrieves a User object from its name property.
Room
  
Retrieves a Room Variable from its name.
Room
  
getVariables():Array
Retrieves all the Room Variables of this Room.
Room
Property Detail
capacityproperty
capacity:int  [read-only]

Returns the maximum amount of users, including spectators, that can be contained in this Room.


Implementation
    public function get capacity():int
groupIdproperty 
groupId:String  [read-only]

Returns the Room Group name. Each Group is identified by a unique string (its name or id) and it represents a different "container" for Rooms.

Room Groups enable developers to organize Rooms under different types or categories and let clients select only those Groups they are interested in, in order to receive their events only. This is done via the SubscribeRoomGroupRequest and UnsubscribeRoomGroupRequest requests.

The default value is default.


Implementation
    public function get groupId():String

See also

idproperty 
id:int  [read-only]

Indicates the id of this Room. It is unique and it is generated by the server when the Room is created.


Implementation
    public function get id():int
isGameproperty 
isGame:Boolean

Indicates whether this is a Game Room or not.

NOTE: setting the isGame property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


Implementation
    public function get isGame():Boolean
    public function set isGame(value:Boolean):void
isHiddenproperty 
isHidden:Boolean

Indicates whether this Room is hidden or not. This is a utility flag that can be used by developers to hide certain Rooms from the interface of their application.

NOTE: setting the isHidden property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


Implementation
    public function get isHidden():Boolean
    public function set isHidden(value:Boolean):void
isJoinedproperty 
isJoined:Boolean

Indicates whether the client joined this Room or not.

NOTE: setting the isJoined property manually has no effect on the server and can disrupt the API functioning. Use the JoinRoomRequest request to join a new Room instead.


Implementation
    public function get isJoined():Boolean
    public function set isJoined(value:Boolean):void

See also

isPasswordProtectedproperty 
isPasswordProtected:Boolean

Indicates whether this Room requires a password to be joined or not.

NOTE: setting the isPasswordProtected property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room's password set when the Room is created or by means of the ChangeRoomPasswordStateRequest request.


Implementation
    public function get isPasswordProtected():Boolean
    public function set isPasswordProtected(value:Boolean):void

See also

maxSpectatorsproperty 
maxSpectators:int

Returns the maximum number of spectators allowed in this Room (Game Rooms only).

NOTE: setting the maxSpectators property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Game Room.


Implementation
    public function get maxSpectators():int
    public function set maxSpectators(value:int):void
maxUsersproperty 
maxUsers:int

Returns the maximum number of users allowed in this Room. In case of Game Rooms, this is the maximum number of players.

NOTE: setting the maxUsers property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


Implementation
    public function get maxUsers():int
    public function set maxUsers(value:int):void
nameproperty 
name:String

Indicates the name of this Room. Two Rooms in the same Zone can't have the same name.

NOTE: setting the name property manually has no effect on the server and can disrupt the API functioning. Use the ChangeRoomNameRequest request instead.


Implementation
    public function get name():String
    public function set name(value:String):void

See also

playerListproperty 
playerList:Array  [read-only]

Returns a list of User objects representing the players currently inside this Room (Game Rooms only).


Implementation
    public function get playerList():Array
propertiesproperty 
properties:Object

Defines a generic utility object that can be used to store custom Room data. The values added to this object are for client-side use only and are never transmitted to the server or to the other clients.


Implementation
    public function get properties():Object
    public function set properties(value:Object):void
roomManagerproperty 
roomManager:IRoomManager

Returns a reference to the Room Manager which manages this Room.

NOTE: setting the roomManager property manually has no effect on the server and can disrupt the API functioning.


Implementation
    public function get roomManager():IRoomManager
    public function set roomManager(value:IRoomManager):void
spectatorCountproperty 
spectatorCount:int

Returns the current number of spectators in this Room (Game Rooms only).

NOTE: setting the spectatorCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.


Implementation
    public function get spectatorCount():int
    public function set spectatorCount(value:int):void
spectatorListproperty 
spectatorList:Array  [read-only]

Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).


Implementation
    public function get spectatorList():Array
userCountproperty 
userCount:int

Returns the current number of users in this Room. In case of Game Rooms, this is the number of players.

NOTE: setting the userCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.


Implementation
    public function get userCount():int
    public function set userCount(value:int):void
userListproperty 
userList:Array  [read-only]

Returns a list of User objects representing all the users currently inside this Room.


Implementation
    public function get userList():Array
Method Detail
containsUser()method
public function containsUser(user:User):Boolean

Indicates whether the specified user is currently inside this Room or not.

Parameters

user:User — The User object representing the user whose presence in this Room must be checked.

Returns
Booleantrue if the user is inside this Room; false otherwise.
containsVariable()method 
public function containsVariable(name:String):Boolean

Indicates whether this Room has the specified Room Variable set or not.

Parameters

name:String — The name of the Room Variable whose existance in this Room must be checked.

Returns
Booleantrue if a Room Variable with the passed name exists in this Room.
getUserById()method 
public function getUserById(id:int):User

Retrieves a User object from its id property.

Parameters

id:int — The id of the user to be retrieved.

Returns
User — The User object representing the user, or null if no user with the passed id exists in this Room.

See also

getUserByName()method 
public function getUserByName(name:String):User

Retrieves a User object from its name property.

Parameters

name:String — The name of the user to be found.

Returns
User — The User object representing the user, or null if no user with the passed name exists in this Room.

See also

getVariable()method 
public function getVariable(name:String):RoomVariable

Retrieves a Room Variable from its name.

Parameters

name:String — The name of the Room Variable to be retrieved.

Returns
RoomVariable — The RoomVariable object representing the Room Variable, or null if no Room Variable with the passed name exists in this Room.

See also

getVariables()method 
public function getVariables():Array

Retrieves all the Room Variables of this Room.

Returns
Array — The list of RoomVariable objects associated with this Room.

See also