new SFSUserManager()

Developers never istantiate the SFSUserManager class: this is done internally by the SmartFoxServer 2X API; get a reference to it using the SmartFox.userManager property.

This class keeps track of all the users that are currently joined in the same Rooms of the current user. It also provides utility methods to look for users by name and id.

See also
SmartFox#userManager

Methods

containsUser(user) → boolean

Indicates whether a user exists in the local users list or not.

Parameter

Name Type Optional Description

user

SFSUser

 

The SFSUser object representing the user whose presence in the users list is to be tested.

Returns

boolean true if the passed user exists in the users list.

containsUserId(userId) → boolean

Indicates whether a user exists in the local users list or not from the id.

Parameter

Name Type Optional Description

userId

number

 

The id of the user whose presence in the users list is to be tested.

See also
SFSUser#id
Returns

boolean true if the passed user exists in the users list.

containsUserName(userName) → boolean

Indicates whether a user exists in the local users list or not from the name.

Parameter

Name Type Optional Description

userName

string

 

The name of the user whose presence in the users list is to be tested.

See also
SFSUser#name
Returns

boolean true if the passed user exists in the users list.

getUserById(userId) → SFSUser

Retrieves a SFSUser object from its id property.

Parameter

Name Type Optional Description

userId

number

 

The id of the user to be retrieved.

See also
SFSUser#id
Returns

SFSUser The SFSUser object representing the user, or undefined if no user with the passed id exists in the local users list.

getUserByName(userName) → SFSUser

Retrieves a SFSUser object from its name property.

Parameter

Name Type Optional Description

userName

string

 

The name of the user to be retrieved.

See also
SFSUser#name
Returns

SFSUser The SFSUser object representing the user, or undefined if no user with the passed name exists in the local users list.

getUserCount() → number

Returns the total number of users in the local users list.

Returns

number The number of users in the local users list.

getUserList() → Array of SFSUser

Get the whole list of users inside the Rooms joined by the client.

Returns

Array of SFSUser The list of SFSUser objects representing the users in the local users list.