Class SFS2X.Requests.System.FindRoomsRequest

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

Class Summary
Constructor Attributes Constructor Name and Description
Creates a new FindRoomsRequest instance.

Class Detail

SFS2X.Requests.System.FindRoomsRequest(expr, groupId, limit)
Creates a new FindRoomsRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

By providing a matching expression and a search scope (a Group or the entire Zone), with this request it is possible to find those Rooms matching the passed criteria on the server side and retrieve them by means of the roomFindResult event.

The following example looks for all the server Rooms whose "country" Room Variable is set to "Sweden":

function someMethod()
	sfs.addEventListener(SFS2X.SFSEvent.ROOM_FIND_RESULT, onRoomFindResult, this);
	// Create a matching expression to find Rooms with a "country" variable equal to "Sweden"
	var exp = new SFS2X.Entities.Match.MatchExpression("country", SFS2X.Entities.Match.StringMatch.EQUALS, "Sweden");
	// Find the Rooms
	sfs.send(new SFS2X.Requests.System.FindRoomRequest(exp));

function onRoomFindResult(evtParams)
	console.log("Rooms found: " + evtParams.rooms);
{MatchExpression} expr
A matching expression that the system will use to retrieve the Rooms.
{String} groupId Optional, Default: null
The name of the Group where to search for matching Rooms; if null, the search is performed in the whole Zone.
{Number} limit Optional, 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: