SFSRoomManager

Manages the client-side Room List.


This manager keeps track of all Rooms available in the client-side Room List and subscriptions to Room Groups. It also provides utility methods to look for Rooms by name and id, retrieve Rooms belonging to a specific Group and more.

Members

(readonly) roomCount :number

Current number of Rooms in the Room List.
Type:
  • number

Methods

containsGroup(groupId) → {boolean}

Indicates whether the specified Group has been subscribed by the client.
Parameters:
NameTypeDescription
groupIdstringThe name of the Group.
Returns:
true if the client subscribed the passed Group.
Type: 
boolean

containsRoom(idOrName) → {boolean}

Indicates whether the specified Room exists in the Room List.
Parameters:
NameTypeDescription
idOrNamenumber | stringThe id or name of the SFSRoom object whose presence in the Room List should be checked.
Returns:
true if the passed Room is found in the Room List.
Type: 
boolean

containsRoomInGroup(idOrName, groupId) → {boolean}

Indicates whether the Room List contains a Room belonging to the specified Group.
Parameters:
NameTypeDescription
idOrNamenumber | stringThe id or name of the SFSRoom object whose presence in the Room List should be checked.
groupIdstringThe name of the Group to which the specified Room must belong.
Returns:
true if the Room List contains the passed Room and it belongs to the specified Group.
Type: 
boolean

getJoinedRooms() → {Array.<SFSRoom>}

Returns the list of Rooms currently joined by the client.
Returns:
The list of objects representing the Rooms currently joined by the client.
Type: 
Array.<SFSRoom>

getRoomById(id) → {SFSRoom}

Retrieves a SFSRoom object by its id.
Parameters:
NameTypeDescription
idnumberThe id of the Room.
Returns:
An object representing the requested Room; null if no SFSRoom object with the passed id can be found in the Room List.
Type: 
SFSRoom

getRoomByName(name) → {SFSRoom}

Retrieves a SFSRoom object by its name.
Parameters:
NameTypeDescription
namestringThe name of the Room.
Returns:
An object representing the requested Room; null if no SFSRoom object with the passed name can be found in the Room List.
Type: 
SFSRoom

getRoomGroups() → {Array.<string>}

Returns the names of Groups currently subscribed by the client.

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

Returns:
A list of Group names.
Type: 
Array.<string>

getRoomList() → {Array.<SFSRoom>}

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 subscribed by the client.

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

Returns:
The list of the available SFSRoom objects.
Type: 
Array.<SFSRoom>

getRoomListFromGroup(groupId) → {Array.<SFSRoom>}

Retrieves the list of Rooms which are grouped under the specified Group.
Parameters:
NameTypeDescription
groupIdstringThe identifier (name) of the Group.
Returns:
The list of SFSRoom objects belonging to the passed Group.
Type: 
Array.<SFSRoom>

getUserRooms(user) → {Array.<SFSRoom>}

Retrieves the list of Rooms joined by the specified User.

The list contains only those Rooms "known" by the Room Manager; the User could be joined in other Rooms the client is not aware of.

Parameters:
NameTypeDescription
userSFSUserThe object representing the User to look for in the current Room List.
Returns:
The list of Rooms joined by the passed User.
Type: 
Array.<SFSRoom>