LoginRequest

Logs the client in one of the server Zones.


Each Zone represent an indipendent multiuser application governed by SmartFoxServer. In order to join a Zone, a User name and password are usually required. In order to validate the User credentials, a custom login system should be implemented in a server-side Extension attached to the Zone. Read the SmartFoxServer documentation for more information on custom login.

If the login operation is successful, the logged User receives a SFSEvent.LOGIN event; otherwise the SFSEvent.LOGIN_ERROR event is fired.

Constructor

new LoginRequest(userNameopt, passwordopt, zoneNameopt, parametersopt)

Creates a new instance of the LoginRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
userNamestring<optional>
The name to be assigned to the User; if an empty string is passed and the Zone allows guest Users login, the name is generated automatically by the server.
passwordstring<optional>
The User password to access the system. SmartFoxServer doesn't offer a default authentication system, so the password must be validated implementing a custom login system in a server-side Extension attached to the Zone.
zoneNamestring<optional>
nullThe name (case-sensitive) of the server Zone to login to. If the Zone name is not passed here, the client will use the Zone global setting.
parametersSFSObject<optional>
nullAn object containing custom parameters to be passed to the Zone Extension (requires a custom login system to be in place).