Packagecom.smartfoxserver.v2.requests
Classpublic class FindRoomsRequest
InheritanceFindRoomsRequest Inheritance com.smartfoxserver.v2.requests.BaseRequest

Retrieves a list of Rooms from the server which match the specified criteria.

By providing a matching expression and a search scope (a Group or the entire Zone), SmartFoxServer can find those Rooms matching the passed criteria and return them by means of the roomFindResult event.

View the examples

See also

MatchExpression
roomFindResult event


Public Methods
 MethodDefined By
  
FindRoomsRequest(expr:MatchExpression, groupId:String = null, limit:int = 0)
Creates a new FindRoomsRequest instance.
FindRoomsRequest
Constructor Detail
FindRoomsRequest()Constructor
public function FindRoomsRequest(expr:MatchExpression, groupId:String = null, limit:int = 0)

Creates a new FindRoomsRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters
expr:MatchExpression — A matching expression that the system will use to retrieve the Rooms.
 
groupId:String (default = null) — The name of the Group where to search for matching Rooms; if null, the search is performed in the whole Zone.
 
limit:int (default = 0) — The maximum size of the list of Rooms that will be returned by the roomFindResult event. If 0, all the found Rooms are returned.

See also

Examples
The following example looks for all the server Rooms whose "country" Room Variable is set to Sweden:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSEvent.ROOM_FIND_RESULT, onRoomFindResult);
         
         // Create a matching expression to find Rooms with a "country" variable equal to "Sweden"
         var exp:MatchExpression = new MatchExpression("country", StringMatch.EQUALS, "Sweden");
         
         // Find the Rooms
         sfs.send(new FindRoomsRequest(exp));
     }
     
     private function onRoomFindResult(evt:SFSEvent):void
     {
         trace("Rooms found: " + evt.params.rooms);
     }