Packagecom.smartfoxserver.v2.entities.managers
Classpublic class SFSRoomManager
InheritanceSFSRoomManager Inheritance Object
Implements IRoomManager

The SFSRoomManager class is the entity in charge of managing the client-side Rooms list. It keeps track of all the Rooms available in the client-side Rooms list and of subscriptions to multiple Room Groups. It also provides various utility methods to look for Rooms by name and id, retrieve Rooms belonging to a specific Group, etc.

See also

SmartFox.roomManager


Public Methods
 MethodDefined By
  
Creates a new SFSRoomManager instance.
SFSRoomManager
  
containsGroup(groupId:String):Boolean
Indicates whether the specified Group has been subscribed by the client or not.
SFSRoomManager
  
containsRoom(idOrName:*):Boolean
Indicates whether a Room exists in the Rooms list or not.
SFSRoomManager
  
containsRoomInGroup(idOrName:*, groupId:String):Boolean
Indicates whether the Rooms list contains a Room belonging to the specified Group or not.
SFSRoomManager
  
Returns a list of Rooms currently joined by the client.
SFSRoomManager
  
Retrieves a Room object from its id.
SFSRoomManager
  
getRoomByName(name:String):Room
Retrieves a Room object from its name.
SFSRoomManager
  
Returns the current number of Rooms in the Rooms list.
SFSRoomManager
  
Returns the names of Room Groups currently subscribed by the client.
SFSRoomManager
  
getRoomList():Array
Returns a list of Rooms currently "known" by the client.
SFSRoomManager
  
getRoomListFromGroup(groupId:String):Array
Retrieves the list of Rooms which are part of the specified Room Group.
SFSRoomManager
  
getUserRooms(user:User):Array
Retrieves a list of Rooms joined by the specified user.
SFSRoomManager
Constructor Detail
SFSRoomManager()Constructor
public function SFSRoomManager(sfs:SmartFox)

Creates a new SFSRoomManager instance.

NOTE: developers never instantiate a SFSRoomManager manually: this is done by the SmartFoxServer 2X API internally. A reference to the existing instance can be retrieved using the SmartFox.roomManager property.

Parameters
sfs:SmartFox — An instance of the SmartFoxServer 2X client API main SmartFox class.

See also

Method Detail
containsGroup()method
public function containsGroup(groupId:String):Boolean

Indicates whether the specified Group has been subscribed by the client or not.

Parameters

groupId:String — The name of the Group.

Returns
Booleantrue if the client subscribed the passed Group.
containsRoom()method 
public function containsRoom(idOrName:*):Boolean

Indicates whether a Room exists in the Rooms list or not.

Parameters

idOrName:* — The id or name of the Room object whose presence in the Rooms list is to be tested.

Returns
Booleantrue if the passed Room exists in the Rooms list.
containsRoomInGroup()method 
public function containsRoomInGroup(idOrName:*, groupId:String):Boolean

Indicates whether the Rooms list contains a Room belonging to the specified Group or not.

Parameters

idOrName:* — The id or name of the Room object whose presence in the Rooms list is to be tested.
 
groupId:String — The name of the Group to which the specified Room must belong.

Returns
Booleantrue if the Rooms list contains the passed Room and it belongs to the specified Group.
getJoinedRooms()method 
public function getJoinedRooms():Array

Returns a list of Rooms currently joined by the client.

Returns
Array — The list of Room objects representing the Rooms currently joined by the client.
getRoomById()method 
public function getRoomById(id:int):Room

Retrieves a Room object from its id.

Parameters

id:int — The id of the Room.

Returns
Room — An object representing the requested Room; null if no Room object with the passed id exists in the Rooms list.
getRoomByName()method 
public function getRoomByName(name:String):Room

Retrieves a Room object from its name.

Parameters

name:String — The name of the Room.

Returns
Room — An object representing the requested Room; null if no Room object with the passed name exists in the Rooms list.
getRoomCount()method 
public function getRoomCount():int

Returns the current number of Rooms in the Rooms list.

Returns
int — The number of Rooms in the Rooms list.
getRoomGroups()method 
public function getRoomGroups():Array

Returns the names of Room Groups currently subscribed by the client.

NOTE: at login time, the client automatically subscribes all the Room Groups specified in the Zone's Default Room Groups setting.

Returns
Array — A list of Room Group names.
getRoomList()method 
public function getRoomList():Array

Returns a list of Rooms currently "known" by the client. The list contains all the Rooms that are currently joined and all the Rooms belonging to the Room Groups that have been subscribed.

NOTE: at login time, the client automatically subscribes all the Room Groups specified in the Zone's Default Room Groups setting.

Returns
Array — The list of the available Room objects.
getRoomListFromGroup()method 
public function getRoomListFromGroup(groupId:String):Array

Retrieves the list of Rooms which are part of the specified Room Group.

Parameters

groupId:String — The name of the Group.

Returns
Array — The list of Room objects belonging to the passed Group.
getUserRooms()method 
public function getUserRooms(user:User):Array

Retrieves a list of Rooms joined by the specified user. The list contains only those Rooms "known" by the Room Manager; the user might have joined others the client is not aware of.

Parameters

user:User — A User object representing the user to look for in the current Rooms list.

Returns
Array — The list of Rooms joined by the passed user.