SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::requests::LoginRequest Class Reference

Logs the current user in one of the server Zones. More...

#include <LoginRequest.h>

Inheritance diagram for sfs3::requests::LoginRequest:
[legend]

Public Member Functions

 LoginRequest (std::string userName, std::optional< std::string > pass=std::nullopt, std::optional< std::string > zoneName=std::nullopt, entities::SFSObject *params=nullptr)
 Creates a new LoginRequest.

Detailed Description

Logs the current user in one of the server Zones.

Each Zone is an independent multiuser application governed by SmartFoxServer. To join a Zone you usually need a user name and a password. To check the credentials of the user, write a custom login process in the server-side Extension of the Zone.

Read the SmartFoxServer 3 documentation about the login process for more information.

On success the current user receives a event::SFSEvent::LOGIN event, otherwise a event::SFSEvent::LOGIN_ERROR event.

See also
event::SFSEvent::LOGIN
event::SFSEvent::LOGIN_ERROR

Constructor & Destructor Documentation

◆ LoginRequest()

sfs3::requests::LoginRequest::LoginRequest ( std::string userName,
std::optional< std::string > pass = std::nullopt,
std::optional< std::string > zoneName = std::nullopt,
entities::SFSObject * params = nullptr )

Creates a new LoginRequest.

Pass it to SmartFox::send for the request to be performed.

Parameters
userNameThe name to give to the user. Pass an empty string to let the server generate the name, which works only if the Zone allows guest users.
passThe password of the user. SmartFoxServer has no built-in authentication system, so the password is checked by the custom login system of the Zone Extension.
zoneNameThe name of the Zone to log in to. It is case sensitive. When it is empty the client uses ConfigData::zone.
paramsCustom parameters to pass to the Zone Extension. It needs a custom login system in place. The caller keeps the ownership.
See also
SmartFox::send
entities::SFSObject

The documentation for this class was generated from the following files:
  • requests/LoginRequest.h
  • requests/LoginRequest.cpp