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

Namespace: Sfs2X.Requests
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.0.0 (1.7.0)

Syntax

C#
public class FindRoomsRequest : BaseRequest

Remarks

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 ROOM_FIND_RESULT event.

Examples

The following example looks for all the server Rooms whose "country" Room Variable is set to Sweden:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ROOM_FIND_RESULT, OnRoomFindResult);
    // Create a matching expression to find Rooms with a "country" variable equal to "Sweden"
    MatchExpression expr = new MatchExpression('country', StringMatch.EQUALS, 'Sweden');
    // Find the Rooms
    sfs.Send( new FindRoomRequest(expr) );
}
void OnRoomFindResult(BaseEvent evt) {
    Console.WriteLine("Rooms found: " + (List<Room>)evt.Params["rooms"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Rooms found: " + (List<Room>)evt.Params["rooms"]);        // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    Sfs2X.Requests..::..FindRoomsRequest

See Also