floo::BMXClient

Client

#include <bmx_client.h>

Inherits from floo::BMXNetworkListener

Public Functions

Name
BMXClientPtr create(BMXSDKConfigPtr config)
Create BMXClient
virtual ~BMXClient()
Destructor
virtual BMXSDKConfigPtr getSDKConfig() =0
Get SDK settings
virtual BMXUserService & getUserService() =0
Get user Service
virtual BMXChatService & getChatService() =0
Get chat Service
virtual BMXGroupService & getGroupService() =0
Get group Service
virtual BMXRosterService & getRosterService() =0
Get roster Service
virtual BMXPushService & getPushService() =0
Get push Service
virtual BMXErrorCode signUpNewUser(const std::string & username, const std::string & password, BMXUserProfilePtr & bmxUserProfilePtr) =0
To register a new user, username and password are required
virtual BMXErrorCode signInByName(const std::string & name, const std::string & password) =0
Login by username
virtual BMXErrorCode signInById(int64_t , const std::string & password) =0
Login by user ID
virtual BMXErrorCode fastSignInByName(const std::string & name, const std::string & password) =0
Quick login by username (requires a successful previous login, faster login)
virtual BMXErrorCode fastSignInById(int64_t uid, const std::string & password) =0
Quick login by user ID (requires a successful previous login, faster login)
virtual BMXErrorCode signOut(int64_t uid =0, bool ignoreUnbindDevice =false) =0
Log out
virtual BMXConnectStatus connectStatus() =0
Get the current connection state with server
virtual BMXSignInStatus signInStatus() =0
Get the current login state
virtual void reconnect() =0
Force reconnection
virtual void onNetworkChanged(BMXNetworkType type, bool reconnect) =0
Process network changes in messaging
virtual void disconnect() =0
Disconnect
virtual BMXErrorCode changeAppId(const std::string & appId, const std::string & appSecret ="") =0
Change the appId of SDK, which also update the appId in BMXConfig.
virtual BMXErrorCode initializeServerConfig(bool isLocal) =0
Get the server network configuration of app, which can be called after initializing SDK and before logging in, so as to get the server configuration in advance and speed up logging in.
virtual void sendMessage(BMXMessagePtr msg) =0
When send a message, the change of message status will be notified by listener. In the case of sending a group message in a specified group with group read acknowledgement enabled, the interface will automatically obtain the group member list id and fill it in the message config, without the need for the client to fill the group member list by itself.

Protected Functions

Name
BMXClient()

Additional inherited members

Public Functions inherited from floo::BMXNetworkListener

Name
virtual ~BMXNetworkListener()

Public Functions Documentation

function create

static BMXClientPtr create(
    BMXSDKConfigPtr config
)

Create BMXClient

Parameters:

  • config BMXSDKConfig SDK configuration object created by local client-side already

Return: BMXClientPtr

Example:

client = BMXClient::create(config);

function ~BMXClient

inline virtual ~BMXClient()

Destructor

Example:

function getSDKConfig

virtual BMXSDKConfigPtr getSDKConfig() =0

Get SDK settings

Return: BMXSDKConfigPtr

Example:

function getUserService

virtual BMXUserService & getUserService() =0

Get user Service

Return: BMXUserService

Example:

client->getUserService().addUserListener(userListener);
client->getUserService().removeUserListener(userListener);
BMXErrorCode errorCode = client->getUserService().getProfile(profile, false);
BMXErrorCode errorCode = client->getUserService().setNickname(params[0]);

function getChatService

virtual BMXChatService & getChatService() =0

Get chat Service

Return: BMXChatService

Example:

client->getChatService().addChatListener(chatListener);
client->getChatService().removeChatListener(chatListener);
BMXConversationList conversationList = client->getChatService().getAllConversations();
BMXErrorCode errorCode = client->getChatService().retrieveHistoryMessages(conversationList[0], 0, 10, list);

function getGroupService

virtual BMXGroupService & getGroupService() =0

Get group Service

Return: BMXGroupService

Example:

client->getGroupService().addGroupListener(groupListener);
client->getGroupService().removeGroupListener(groupListener);
BMXErrorCode errorCode = client->getGroupService().search(groupId, group, false);
errorCode = client->getGroupService().setMyNickname(group, params[1]);
BMXErrorCode errorCode = client->getGroupService().search(groupId, group, false);
errorCode = client->getGroupService().join(group, params[1]);
BMXErrorCode errorCode = client->getGroupService().search(groupId, group, false);
errorCode = client->getGroupService().leave(group);

function getRosterService

virtual BMXRosterService & getRosterService() =0

Get roster Service

Return: BMXRosterService

Example:

client->getRosterService().addRosterListener(rosterListener);
client->getRosterService().removeRosterListener(rosterListener);
BMXErrorCode errorCode = client->getRosterService().apply(rosterId, params[1]);
BMXErrorCode errorCode = client->getRosterService().remove(rosterId);
BMXErrorCode errorCode = client->getRosterService().accept(rosterId);
BMXErrorCode errorCode = client->getRosterService().decline(rosterId, params[1]);

function getPushService

virtual BMXPushService & getPushService() =0

Get push Service

Return: BMXPushService

Example:

function signUpNewUser

virtual BMXErrorCode signUpNewUser(
    const std::string & username,
    const std::string & password,
    BMXUserProfilePtr & bmxUserProfilePtr
) =0

To register a new user, username and password are required

Parameters:

  • username Username
  • password User password
  • bmxUserProfilePtr After successful registration, get the profile of the newly registered user from this function, and initially passed in a pointing-to-empty shared_ptr object.

Return: BMXErrorCode

Example:

function signInByName

virtual BMXErrorCode signInByName(
    const std::string & name,
    const std::string & password
) =0

Login by username

Parameters:

  • name Username
  • password User password

Return: BMXErrorCode

Example:

BMXErrorCode errorCode = client->signInByName(params[0], params[1]);

function signInById

virtual BMXErrorCode signInById(
    int64_t ,
    const std::string & password
) =0

Login by user ID

Parameters:

  • int64_t User id
  • password User password

Return: BMXErrorCode

Example:

function fastSignInByName

virtual BMXErrorCode fastSignInByName(
    const std::string & name,
    const std::string & password
) =0

Quick login by username (requires a successful previous login, faster login)

Parameters:

  • name Username
  • password User password (for sdk to automatically update user token when internal token expires)

Return: BMXErrorCode

Example:

function fastSignInById

virtual BMXErrorCode fastSignInById(
    int64_t uid,
    const std::string & password
) =0

Quick login by user ID (requires a successful previous login, faster login)

Parameters:

  • uid User id
  • password User password (for sdk to automatically update user token when internal token expires)

Return: BMXErrorCode

Example:

function signOut

virtual BMXErrorCode signOut(
    int64_t uid =0,
    bool ignoreUnbindDevice =false
) =0

Log out

Parameters:

  • uid UID of logged out user (default 0 to logout the current user)
  • ignoreUnbindDevice Whether the unbind device operation is ignored when the user logout. Set to true when server's unbinding device operation is ignored and forced to logout directly when some servers are inaccessible.

Return: BMXErrorCode

Example:

BMXErrorCode errorCode = client->signOut();

function connectStatus

virtual BMXConnectStatus connectStatus() =0

Get the current connection state with server

Return: BMXConnectStatus

Example:

function signInStatus

virtual BMXSignInStatus signInStatus() =0

Get the current login state

Return: BMXSignInStatus

Example:

if (client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 3 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 1 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 2 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 1 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 1 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 2 && client->signInStatus() == BMXSignInStatus::SignIn) {
if (params.size() >= 2 && client->signInStatus() == BMXSignInStatus::SignIn) {

function reconnect

virtual void reconnect() =0

Force reconnection

Example:

function onNetworkChanged

virtual void onNetworkChanged(
    BMXNetworkType type,
    bool reconnect
) =0

Process network changes in messaging

Parameters:

  • type Changed network type
  • reconnect Network needs to reconnect or not

Reimplements: floo::BMXNetworkListener::onNetworkChanged

Example:

function disconnect

virtual void disconnect() =0

Disconnect

Example:

function changeAppId

virtual BMXErrorCode changeAppId(
    const std::string & appId,
    const std::string & appSecret =""
) =0

Change the appId of SDK, which also update the appId in BMXConfig.

Parameters:

  • appId Newly changed appId

Return: BMXErrorCode

Example:

function initializeServerConfig

virtual BMXErrorCode initializeServerConfig(
    bool isLocal
) =0

Get the server network configuration of app, which can be called after initializing SDK and before logging in, so as to get the server configuration in advance and speed up logging in.

Parameters:

  • isLocal True to use locally cached DNS configuration, false to get the latest configuration from server.

Return: BMXErrorCode

Example:

function sendMessage

virtual void sendMessage(
    BMXMessagePtr msg
) =0

When send a message, the change of message status will be notified by listener. In the case of sending a group message in a specified group with group read acknowledgement enabled, the interface will automatically obtain the group member list id and fill it in the message config, without the need for the client to fill the group member list by itself.

Parameters:

  • msg Message to be sent

Protected Functions Documentation

Example:

client->sendMessage(msg);

function BMXClient

BMXClient()

Example:


Updated on 2022-01-26 at 17:20:40 +0800

© 2019-2023 MaximTop | Homepage Last modified time: 2023-08-09 14:48:15

results matching ""

    No results matching ""