FindUsersRequest
Retrieves a list of users from the server which match the specified criteria.
new FindUsersRequest(expr[, target][, limit])
Creates a new FindUsersRequest instance. The instance must be passed to the SmartFox.send() method for the request to be executed.
By providing a matching expression and a search scope (a Room, a Group or the entire Zone), with this request it is possible to find those users matching the passed criteria on the server side and retrieve them by means of the userFindResult event.
Example
This example looks for all the users whose "age" User Variable is greater than "29".
function someMethod()
{
sfs.addEventListener(SFS2X.SFSEvent.USER_FIND_RESULT, onUserFindResult, this);
// Create a matching expression to find users with an "age" variable greater than 29:
var exp = new SFS2X.MatchExpression("age", SFS2X.NumberMatch.GREATER_THAN, 29);
// Find the users
sfs.send(new SFS2X.FindUserRequest(exp));
}
function onUserFindResult(evtParams)
{
console.log("Users found: " + evtParams.users);
}
Parameters
Name | Type | Optional | Description |
---|---|---|---|
expr |
|
|
A matching expression that the system will use to retrieve the users. |
target |
|
Yes |
The name of a Group or a single SFSRoom object where to search for matching users; if Defaults to |
limit |
|
Yes |
The maximum size of the list of users that will be returned by the userFindResult event. If Defaults to |