NAV Navbar
C# C++ Objective-C Java JavaScript Cloud Code Raw
  • Introduction
  • BrainCloudWrapper
  • Client API
  • Cloud Code
  • Server to Server (S2S)
  • Appendix
  • Introduction

    brainCloud Architecture

    What is brainCloud?

    brainCloud is a ready-made back-end platform for the development of feature-rich games, apps and things. brainCloud provides the features you need – along with comprehensive tools to support your team during development, testing and user support.

    brainCloud consists of:

    SDK libraries

    There are custom brainCloud libraries for several languages including:

    Engine Support

    brainCloud supports the most popular gaming engines, including:

    BrainCloudWrapper

    // Unity
    
    //Note: Ensure of have selected your app using the brainCloud Unity Plugin
    
    using UnityEngine;
    
    public class BCConfig : MonoBehaviour {
    
        private BrainCloudWrapper _bc;
    
        public BrainCloudWrapper GetBrainCloud()
        {
            return _bc;
        }   
    
        void Awake ()
        {
            DontDestroyOnLoad(gameObject);
            _bc = gameObject.AddComponent<BrainCloudWrapper>();
    
            _bc.WrapperName = gameObject.name;    // Optional: Set a wrapper name
            _bc.Init();      // Init data is taken from the brainCloud Unity Plugin     
        }
    }
    
    
    // C#
    _bc = new BrainCloudWrapper("_mainWrapper");
    
    _bc = new BrainCloudWrapper("_mainWrapper");
    
    _bc = new BrainCloudWrapper("_mainWrapper");
    
    _bc = [[BrainCloudWrapper alloc] init: @"_mainWrapper"]
    
    _bc = new BrainCloudWrapper("_mainWrapper");
    

    The BrainCloudWrapper class provides an easier way for developers to handle user authentication when they are getting started with the authentication system. This includes persisting authentication data between application runs.

    By using the wrapper authentication methods, the anonymous and profile IDs will be automatically persisted upon successful authentication. When authenticating, any stored anonymous/profile IDs will be sent to the server. This strategy is useful when using Anonymous authentication.

    Note - you should initialize the wrapper before using it. It will in turn initialize the brainCloud client for you - don't do both!

    Parameters
    Parameter Description
    wrapperName Distincts saved wrapper data. Use when using more than one instance of brainCloud

    AuthenticateAnonymous

    _bc->authenticateAnonymous(this);
    
    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateAnonymous
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AuthenticateAnonymous(successCallback, failureCallback);
    
    _bc.authenticateAnonymous();
    
    [_bc authenticateAnonymous:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    _bc.authenticateAnonymous(callback);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate a user anonymously with brainCloud - used for apps that don't want to bother the user to login, or for users who are sensitive to their privacy.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Error returns
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: {  // Identity does not match any profile
    
                // Reset Profile ID and re-authenticate
                _bc.ResetStoredProfileId();
                _bc.AuthenticateAnonymous();
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: {  // Identity belongs to a different profile
    
                // Reset Profile ID and Anonymous id, and then re-authenticate
                _bc.ResetStoredProfileId();
                _bc.ResetStoredAnonymousId();
                _bc.AuthenticateAnonymous();
                break;
            }
            default: { // Uncaught reasonCode  // Uncaught reasonCode
    
                // Log the error for debugging later
                // ...
                break;
            }
        }
    }
    
    Code Name Description
    40206 MISSING_IDENTITY_ERROR Both an anonymousId and profileId were provided for authentication - but the anonymousId doesn't exist on the server. The profileId may or may not exist. It is possible that the user account was deleted via the Design Portal. The proper recourse is to reset the stored profile id, and re-authenticate. [There is no need to delete the anonymousId since it doesn't exist on the server anyway.]
    40207 SWITCHING_PROFILES This means that the anonymousId provided does point to a profile, but not the same one that was saved in the client. This fails the anonymous security check. For any other authentication type, this might indicate that the user wants to switch accounts (thus the name of the error constant). For anonymous, the only response is to reset both the stored anonymousId and profileId, and then re-authenticate.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication

    AuthenticateUniversal

    const char* userId = "Username";
    const char* password = "passwrd123";
    
    _bc->authenticateUniversal(userId, password, true, this);
    
    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateUniversal
    
    string userId = "Username";
    string password = "passwrd123";
    bool forceCreate = true;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AuthenticateUniversal(userId, password, forceCreate, successCallback, failureCallback);
    
    String userId = "Username";
    String password = "passwrd123";
    
    _bc.authenticateUniversal(userId, password, true, this);
    
    NSString* userId = "UserId";
    NSString* password = "password";
    
    [_bc authenticateUniversal:userId
                   password:password
                forceCreate:true
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
    
    userId = "Username";
    password = "passwrd123";
    
    _bc.authenticateUniversal(userId, password, true, callback);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Universal authentication allows the developer to pass in any user/password string combination. As with all authentication methods, if the create new profile flag is specified as false, the authentication will fail if the user/password combination does not match a user in the database.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The user's ID.
    password The password of the user.
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: {  // Identity does not exist (and client has orphaned profileId)
    
                // Reset profileId and re-authenticate
                _bc.ResetStoredProfileId();
                _bc.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: {  // Identity belongs to a different profile
    
                // [Optional] Prompt user to confirm that they wish to switch accounts?
    
                // Reset profileId and re-authenticate
                _bc.ResetStoredProfileId();
                _bc.AuthenticateUniversal(userId, password, forceCreate);
                break;
            }
            case ReasonCodes.MISSING_PROFILE_ERROR: {  // Identity does not exist
    
                // The account doesn't exist - create it now.
                _bc.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.TOKEN_DOES_NOT_MATCH_USER: {  // Wrong password
    
                // Display a dialog telling the user that the password provided was invalid,
                // and invite them to re-enter the password.
                // ...
                break;
            }
            default: { // Uncaught reasonCode
    
                // Log the error for debugging later
                // ...
                break;
            }
        }
    }
    
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [and unrelated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials don't match (i.e. incorrect password).

    AuthenticateEmailPassword

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateEmailPassword
    
    string email = "someEmail@somedomain.com";
    string password = "userPassword";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateEmailPassword(
        email, password, forceCreate, successCallback, failureCallback);
    
    const char* email = "someEmail@somedomain.com";
    const char* password = "userPassword";
    
    _bc->authenticateEmailPassword(
        email,
        password,
        true,
        this);
    
    NSString* email = @"someEmail@somedomain.com";
    NSString* password = @"userPassword";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateEmailPassword:email
                         password:password
                      forceCreate:true
                  completionBlock:successBlock
             errorCompletionBlock:failureBlock
                         cbObject:nil];
    
    String email = "someEmail@somedomain.com";
    String password = "userPassword";
    
    _bc.authenticateEmailPassword(
        email,
        password,
        true,
        this);
    
    email = "someEmail@somedomain.com";
    password = "userPassword";
    
    _bc.authenticateEmailPassword(email, password, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user with a custom Email and Password. Note that the client app is responsible for collecting (and storing) the e-mail and potentially password (for convenience) in the client data. For the greatest security, force the user to re-enter their password at each login (or at least give them that option).

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    email The e-mail address of the user
    password The password of the user
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: {  // Identity does not exist (and client has orphaned profileId)
    
                // Reset profileId and re-authenticate
                _bc.ResetStoredProfileId();
                _bc.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: {  // Identity belongs to a different profile
    
                // [Optional] Prompt user to confirm that they wish to switch accounts?
    
                // Reset profileId and re-authenticate
                _bc.ResetStoredProfileId();
                _bc.AuthenticateUniversal(userId, password, forceCreate);
                break;
            }
            case ReasonCodes.MISSING_PROFILE_ERROR: {  // Identity does not exist
    
                // The account doesn't exist - create it now.
                _bc.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.TOKEN_DOES_NOT_MATCH_USER: {  // Wrong password
    
                // Display a dialog telling the user that the password provided was invalid,
                // and invite them to re-enter the password.
                // ...
                break;
            }
            default: { // Uncaught reasonCode
    
                // Log the error for debugging later
                // ...
                break;
            }
        }
    }
    
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [and unrelated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials don't match (i.e. incorrect password).

    AuthenticateExternal

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateExternal
    
    string userId = "externalId";
    string token = "externalTokenOrPassword";
    string externalAuthName = "nameOfExternalAuthService";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateExternal(
        userId, token, externalAuthName, forceCreate,
        successCallback, failureCallback);
    
    const char* userId = "externalId";
    const char* token = "externalTokenOrPassword";
    const char* externalAuthName = "nameOfExternalAuthService";
    
    _bc->authenticateExternal(
        userId,
        token,
        externalAuthName,
        true,
        this);
    
    NSString* authId = @"1234";
    NSString* authToken = @"1234-1234-1234-1234";
    NSString* externalAuthName = @"externalSystem";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateExternal:authId
             authenticationToken:authToken
      externalAuthenticationName:externalAuthName
                     forceCreate:true
                 completionBlock:successBlock
            errorCompletionBlock:failureBlock
                        cbObject:nil];
    
    String userId = "externalId";
    String token = "externalTokenOrPassword";
    String externalAuthName = "nameOfExternalAuthService";
    
    _bc.authenticateExternal(
        userId,
        token,
        externalAuthName,
        true,
        this);
    
    userId = "externalId";
    token = "externalTokenOrPassword";
    externalAuthName = "nameOfExternalAuthService";
    
    _bc.authenticateExternal(userId, token, externalAuthName, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user via cloud code (which in turn validates the supplied credentials against an external system). This allows the developer to extend brainCloud authentication to support other backend authentication systems.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The userId
    token The user token (password etc)
    externalAuthName The name of the custom authentication type (linked to a cloud script that performs authentication). Configured via the **Design
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials don't match (according to the 3rd party system). May also indicate an issue with the external authentication script.

    AuthenticateFacebook

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateFacebook
    
    string facebookId = "userFacebookId";
    string token = "tokenFromFacebook";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateFacebook(
        facebookId, token, forceCreate,
        successCallback, failureCallback);
    
    const char* facebookId = "userFacebookId";
    const char* token = "tokenFromFacebook";
    
    _bc->authenticateFacebook(
        userId,
        token,
        true,
        this);
    
    NSString* externalID = @"userFacebookId";
    NSString* authToken = @"tokenFromFacebook";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateExternal:externalID
             authenticationToken:authToken
                     forceCreate:true
                 completionBlock:successBlock
            errorCompletionBlock:failureBlock
                        cbObject:nil];
    
    public void authenticateFacebook(String fbUserId, String fbAuthToken, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    facebookId = "userFacebookId";
    token = "tokenFromFacebook";
    
    _bc.authenticateFacebook(facebookId, token, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user with brainCloud using their Facebook Credentials.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The userId
    facebookId The Facebook ID of the user
    facebookToken The validated token from the Facebook SDK
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Facebook id / token). May also indicate that Facebook integration is not properly configured.

    AuthenticateGameCenter

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateGameCenter
    
    string gameCenterId = "userGameCenterId";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateGameCenter(
        gameCenterId, forceCreate,
        successCallback, failureCallback);
    
    const char* gameCenterId = "userGameCenterId";
    
    _bc->authenticateGameCenter(
        gameCenterId,
        true,
        this);
    
    NSString* gameCenterID = @"userGameCenterId";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateGameCenter:gameCenterID
                     forceCreate:true
                 completionBlock:successBlock
            errorCompletionBlock:failureBlock
                        cbObject:nil];
    
    // N/A
    
    gameCenterId = "userGameCenterId";
    
    _bc.authenticateGameCenter(gameCenterId, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user using their Game Center ID.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    gameCenterId The player's game center ID (use the playerID property from the local GKPlayer object)
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the design portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad gameCenterId)

    AuthenticateGoogle

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateGoogle
    
    string googleId = "myUser@gmail.com";
    string token = "authTokenFromGoogle";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateGoogle(
        googleId, token, forceCreate,
        successCallback, failureCallback);
    
    const char* googleId = "myUser@gmail.com";
    const char* token = "authTokenFromGoogle";
    
    _bc->authenticateGoogle(
        googleId, token, true, this);
    
    NSString* userID = @"myUser@gmail.com";
    NSString* token = @"authTokenFromGoogle";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateGoogle:userID
                          token:token
                    forceCreate:true
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    String googleId = "myUser@gmail.com";
    String token = "authTokenFromGoogle";
    
    _bc.authenticateGoogle(
        googleId, token, true, this);
    
    googleId = "myUser@gmail.com";
    token = "authTokenFromGoogle";
    
    _bc.authenticateGoogle(googleId, token, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user using a google user ID (email address) and google authentication token.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    googleId String representation of google+ userid (email)
    googleToken The authentication token derived via the google apis.
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. googleId and googleToken are invalid). May also indicate that Google Integration is not properly configured.

    AuthenticateSteam

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateSteam
    
    string steamId = "userSteamId";
    string ticket = "sessionTicketFromSteam";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateSteam(
        steamId, ticket, forceCreate,
        successCallback, failureCallback);
    
    const char* steamId = "userSteamId";
    const char* ticket = "sessionTicketFromSteam";
    
    _bc->authenticateSteam(
        steamId, token, true, this);
    
    NSString* userID = @"userSteamId";
    NSString* sessionticket = @"sessionTicketFromSteam";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateSteam:userID
                 sessionTicket:sessionticket
                   forceCreate:true
               completionBlock:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    Steam steamId = "userSteamId";
    Steam ticket = "sessionTicketFromSteam";
    
    _bc.authenticateSteam(
        steamId, token, true, this);
    
    steamId = "userSteamId";
    ticket = "sessionTicketFromSteam";
    
    _bc.authenticateSteam(steamId, ticket, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user using a steam userId and session ticket (without any validation on the userId).

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId String representation of 64 bit steam ID
    sessionTicket The session ticket of the user (hex encoded)
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Steam userId and/or sessionTicket). May also indicate that Steam Integration is not properly configured.

    AuthenticateTwitter

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call AuthenticateTwitter
    
    string twitterId = "userTwitterId";
    string token = "userAuthToken";
    string secret = "secretFromTwitterApi";
    bool forceCreate = true;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.AuthenticateTwitter(
        twitterId, token, secret, forceCreate,
        successCallback, failureCallback);
    
    const char* twitterId = "userTwitterId";
    const char* token = "userAuthToken";
    const char* secret = "secretFromTwitterApi";
    
    _bc->authenticateTwitter(
        twitterId, token, secret, true, this);
    
    NSString* twitterId = @"userTwitterId";
    NSString* token = @"userAuthToken";
    NSString* secret = @"secretFromTwitterApi";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
        [_bc authenticateTwitter:userID
                          token:token
                         secret:secret
                    forceCreate:true
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    String twitterId = "userTwitterId";
    String token = "userAuthToken";
    String secret = "secretFromTwitterApi";
    
    _bc.authenticateTwitter(
        twitterId, token, secret, true, this);
    
    twitterId = "userTwitterId";
    token = "userAuthToken";
    secret = "secretFromTwitterApi";
    
    _bc.authenticateTwitter(twitterId, token, secret, true, responseHandler);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "xpCapped": false,
            "experiencePoints": 230,
            "sent_events": [
            ],
            "playerSessionExpiry": 1200,
            "playerName": "Jimmy",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "loginCount": 23,
            "server_time": 1445545791711,
            "experienceLevel": 0,
            "entities": [
            ],
            "incoming_events": [
            ],
            "currency": {
                "gold": {
                    "purchased": 0,
                    "balance": 0,
                    "consumed": 0,
                    "awarded": 0
                }
            },
            "statistics": {
                "deaths": 0,
                "kills": 0
            },
            "abTestingId": 78,
            "id": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "sessionId": "bg6qf38p2btl0o825s99385nd1",
            "profileId": "47037fc9-ca7b-4f61-a71f-e5a37b0e8a03",
            "newUser": "false"
        }
    }
    

    Authenticate the user using a Twitter user ID, authentication token, and secret from Twitter.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId String representation of Twitter user ID
    token The authentication token derived via the Twitter APIs
    secret The secret given when attempting to link with Twitter
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Twitter userId / token / secret). May also indicate that Twitter integration is not properly configured.

    GetAlwaysAllowProfileSwitch

    bool allowSwitch = _bc.GetAlwaysAllowProfileSwitch();
    
    
    
    bool alwaysAllow = _bc.AlwaysAllowProfileSwitch;
    
    _bc.AlwaysAllowProfileSwitch = false; // Disables profile switches.
    
    bool allowSwitch = _bc.getAlwaysAllowProfileSwitch();
    
    BOOL allowSwitch = _bc.alwaysAllowProfileSwitch;
    
    var allowSwitch = _bc.getAlwaysAllowProfileSwitch();
    

    For non-anonymous authentication methods, a profile ID will be passed in when this value is set to false. This will generate an error on the server if the profile ID passed in does not match the profile associated with the authentication credentials.

    By default, this value is true.

    GetBC

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can use Client
    
    BrainCloudClient _bcClient = _bc.Client; // The internal braiCloud client
    
    BrainCloudWrapper::getBC();
    
    BrainCloudClient.Get();
    
    [BrainCloudWrapper getBC];
    
    // N/A
    

    Method returns a singleton instance of the BrainCloudClient.

    GetInstance

    // Enable the Usage of Singleton Mode. Off by Default
    BrainCloudClient.EnableSingletonMode = true;
    
    BrainCloudWrapper.GetInstance();
    
    BrainCloudWrapper bc = BrainCloudWrapper.GetInstance(); // Gets a Singleton instance of brainCloud
    
    BrainCloudWrapper.getInstance();
    
    [BrainCloudWrapper getInstance];
    
    // N/A
    

    Method returns a singleton instance of the BrainCloudWrapper.

    GetStoredAnonymousId

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can use GetStoredAnonymousId
    
    string anonymousId = _bc.GetStoredAnonymousId();
    
    std::string anonymousId = _bc->getStoredAnonymousId();
    
    String id = _bc.getStoredAnonymousId();
    
    NSString* anonymousId = [_bc getStoredAnonymousId];
    
    var anonymousId = _bc.getStoredAnonymousId();
    

    Returns the stored anonymous ID

    GetStoredProfileId

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetStoredProfileId
    
    string profileId = _bc.GetStoredProfileId();
    
    std::string profileId = _bc->getStoredProfileId();
    
    String id = _bc.getStoredProfileId();
    
    NSString* profileId = [_bc getStoredProfileId];
    
    var profileId = _bc.getStoredProfileId();
    

    Returns the stored profile ID

    Initialize

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can use GetStoredProfileId
    
    string profileId = _bc.GetStoredProfileId();
    
    const char* serverUrl = "https://sharedprod.braincloudservers.com/dispatcherv2";
    const char* secret = "1234-1234-1234-1234";
    const char* appId = "123456";
    
    const char* company = "bitHeads";
    const char* appName = "Awesome Game";
    
    _bc->initialize(serverUrl, secret, appId, "1.0.0", company, appName);
    

    _bc.Init(); // Init data is taken from the brainCloud Unity Plugin ```

    public void initialize(Context ctx, String appId, String secretKey, String version)
    
    NSString* serverUrl = @"https://sharedprod.braincloudservers.com/dispatcherv2";
    NSString* secret = @"1234-1234-1234-1234";
    NSString* appId = @"123456";
    NSString* company = @"bitHeads";
    NSString* appName = @"Awesome Game";
    
    [_bc initialize:serverUrl
          secretKey:secret
              appId:appId
            version:version
         companyName:company
             appName:appName];
    
    secret = "1234-1234-1234-1234";
    appId = "123456";
    
    _bc.initialize(appId, secret, "1.0.0");
    

    Method initializes both BrainCloudWrapper and BrainCloudClient.

    The parameters for this method vary by client (for example the Unity client takes none at all, as all data is pulled from the brainCloud editor menu data).

    Method Parameters
    Parameter Description
    serverURL The URL to the brainCloud server
    secretKey The secret key for your app
    appId The app ID
    version The app version
    companyName Client dependent - The company name used in the keychain for storing anonymous and profile IDs. You are free to pick anything you want.
    appName Client dependent - The app name used in the keychain for storing anonymous and profile IDs. You are free to pick anything you want.

    Reconnect

    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call Reconnect
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[Authenticate Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.Reconnect(successCallback, failureCallback);
    
    _bc->reconnect(this);
    
    _bc.reconnect(this);
    
    - (void)reconnect:(BCCompletionBlock)cb
     errorCompletionBlock:(BCErrorCompletionBlock)ecb
            cbObject:(BCCallbackObject)cbObject;
    
    _bc.reconnect(callback);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Re-authenticates the user with brainCloud

    ResetStoredAnonymousId

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetAlwaysAllowProfileSwitch
    
    _bc.ResetStoredAnonymousId();
    
    _bc->resetStoredAnonymousId();
    
    _bc.resetStoredAnonymousId();
    
    _bc.storedAnonymousId = @"";
    
    _bc.resetStoredAnonymousId();
    

    Resets the anonymous ID to empty string. When the anonymousId is empty a new one will be generated automatically on authentication.

    ResetStoredProfileId

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetAlwaysAllowProfileSwitch
    
    _bc.ResetStoredProfileId();
    
    _bc->resetStoredProfileId();
    
    _bc.resetStoredProfileId();
    
    _bc.storedProfileId = @"";
    
    _bc.resetStoredProfileId();
    

    Resets the profile ID to empty string.

    RunCallbacks

    //Step 1:   Create and initialize the brainCloud Wrapper 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   N/A. The brainCloud Wrapper Updates itself using Unity MonoBehavior Update
    //          However, if you are not using Unity or not using the BrainCloudWrapper as a GameObject, call Update in your own update loop
    _bc.Update();
    
    BrainCloudWrapper::runCallbacks();
    
    _bc.runCallbacks();
    
    [BrainCloudWrapper update];
    
    // N/A
    

    Run callbacks, to be called once per frame from your main thread

    SetAlwaysAllowProfileSwitch

    
    
    _bc.SetAlwaysAllowProfileSwitch(false);    // Default is true
    
    _bc->setAlwaysAllowProfileSwitch(true);
    
    _bc.setAlwaysAllowProfileSwitch(true);
    
    _bc.alwaysAllowProfileSwitch = YES;
    
    _bc.setAlwaysAllowProfileSwitch(true);
    

    For non-anonymous authentication methods, a profile ID will be passed in when this value is set to false. This will generate an error on the server if the profile ID passed in does not match the profile associated with the authentication credentials.

    By default, this value is true.

    Method Parameters
    Parameter Description
    alwaysAllow Controls whether the profile ID is passed in with non-anonymous authentications.

    SetStoredAnonymousId

    
    
    _bc.SetStoredAnonymousId("1234-1234-1234-1234");
    
    _bc->setStoredAnonymousId("1234-1234-1234-1234");
    
    // N/A
    
    _bc.storedAnonymousId = @"1234-1234-1234-1234";
    
    _bc.setStoredAnonymousId("1234-1234-1234-1234");
    

    Sets the stored anonymous ID

    Method Parameters
    Parameter Description
    anonymousId The anonymous ID to set

    SetStoredProfileId

    
    
    _bc.SetStoredProfileId("1234-1234-1234-1234");
    
    _bc->setStoredProfileId("1234-1234-1234-1234");
    
    _bc.setStoredProfileId("1234-1234-1234-1234");
    
    _bc.storedProfileId = @"1234-1234-1234-1234";
    
    _bc.setStoredProfileId("1234-1234-1234-1234");
    

    Sets the stored profile ID

    Method Parameters
    Parameter Description
    profileId The profile ID to set

    Client API

    Authentication

    This section describes the key methods for implementing basic authentication in your app. These methods are all you'll need if you:

    Consult the advanced (Identity) section if/when you want to get even more flexible with authentication (giving users more flexibility to choose their preferred authentication method, merging of profiles, etc.) When implementing brainCloud authentication, there are some key things to keep in mind:

    brainCloud uses an anonymous installation ID (commonly referred to as the anonymous ID) to identify individual devices. This ID must be generated for first use, and saved by the client application. brainCloud provides a convenient method for generating the ID – or the developer can generate it themselves. brainCloud also requires the client to keep track of the most recent profile ID. This, together with the anonymous ID, provides additional security and allows brainCloud to better understand user intent during logins/reconnections. If the user has never connected before the profile ID should be null.

    If you are using the API Explorer, the list of valid Platform IDs can be found here.

    Handy tip: To log a user out of brainCloud, use the Logout method in PlayerState. Note that you don't absolutely need to log users out – their sessions will timeout on the server automatically anyway.

    By default, the timeout length for authenticated users is 20 minutes. This timeout length can be lowered on the brainCloud Dashboard. [Core App Info | Advance Settings > Session Timeout]

    Version Enforcement

    brainCloud's authentication mechanisms allow you to enforce minimum client version requirements – forcing users with obsolete versions of your client app to upgrade before continuing within your application. This is especially useful for scenarios where you've fixed critical client errors, made significant changes to the server-side data structures, or generally just want to ensure that your users all have the best possible experience.

    The client app version (sometimes referred to as the gameVersion) is sent to the server during authentication. It is a string of format "X.X" or "X.X.X" – for example, "1.0.0". The app version is set via the Client or BrainCloudWrapper Initialize() methods.

    The minimum versions that your app supports can be configured on the Core App Info | Platforms page of the design portal.

    If the client app is older than the minimum version specified, authenticate will return a result similar to:

    { "status": 400, "reason_code": 40322, "upgradeAppId": "http://itunes.com/apps/myappname", "status_message": "Processing exception (message): Game version 1.0.0 is obsolete." }

    Recommended behavior of the client is to pop up a dialog inviting the user to upgrade the client, and then redirect them to the appropriate software update page. Note that an upgrade URL may be data-filled with the minimum version # in the server portal.

    Disabled Apps

    brainCloud allows you to easily control whether your app is enabled or disabled via the Core App Info | Advanced Settings page of the portal.

    If for some reason you do decide to disable your app, you are able to configure a custom JSON object to be returned to apps that attempt to login. This JSON is set via the [Edit Disabled Reason] button on that same portal page.

    Once disabled, your provided JSON-data will be returned within an element called disabledReason within the error response. For example: { "reason_code": 40330, "status": 403, "status_message": "Processing exception (bundle): Game is disabled.", "disabledReason": { "message": "Apologies - we will be right back!" }, "severity": "ERROR" }

    System Disabled

    If for some reason your app is System Disabled by brainCloud operations, your app will receive a disabledReason with two elements: sysDisabled: true and message.

    { "reason_code": 40330, "status": 403, "status_message": "Processing exception (bundle): Game is disabled.", "disabledReason": { "sysDisabled": true, "message": "This app has been system disabled. Please contact support." }, "severity": "ERROR" }

    Authentication Methods

    Initialization
    Authentication
    Utility

    AuthenticateAnonymous

    // if it's a new user
    const char* newAnonId = _bc->generateGUID();
    _bc->initializeIdentity(NULL, newAnonId);
    _bc->getAuthenticationService()->authenticateAnonymous(true, this);
    
    // if it's an existing user
    const char* savedProfileId = yourMethodToGetSavedProfileId();
    const char* savedAnonId = yourMethodToGetSavedAnonymousId();
    _bc->initializeIdentity(savedProfileId, savedAnonId);
    _bc->getAuthenticationService()->authenticateAnonymous(false, this);
    
    // note you can also use the BrainCloudWrapper class
    
    _bc.GetAuthenticationService().AuthenticateAnonymous(true, SuccessCallback, FailureCallback, cbObject);
    
    _bc.GetAuthenticationService().AuthenticateAnonymous(true, callback);
    
    [[_bc getAuthenticationService] authenticateAnonymous];
    
    brainCloudClient.authentication.authenticateAnonymous = function(forceCreate, callback);
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    To authenticate anonymously you must have first called InitializeIdentity. You must supply an anonymous ID if you are creating a brand new profile or if you are logging into an already created profile you need to supply the anonymous ID AND the profile ID of the user.

    Once you've logged in successfully make sure to save the anonymous and profile ID for future logins.

    You can generate a new anonymous ID using the convenience method GenerateAnonymousId.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    forceCreate If set to true, create a new profile if anonymous ID not found. If set to false and anonymous ID does not exist on the server, return an error.
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: { // Anonymous id is invalid
    
                // Clear the profile id, generate a new Anonymous id, and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ClearSavedProfileID();
                BrainCloudClient.Get().AuthenticationService.AnonymousId =
                    BrainCloudClient.Get().AuthenticationService.GenerateAnonymousId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateAnonymous(true, OnSuccess_Authenticate, OnError_AuthenticateAnonymous);
                break;
            }
            case ReasonCodes.MISSING_PROFILE_ERROR: { // Anonymous id doesn't exist in database
    
                // The account doesn't exist - create it now.
                BrainCloudClient.Get().AuthenticationService.AuthenticateAnonymous(true, OnSuccess_Authenticate, OnError_AuthenticateAnonymous);
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: {  // Identity belongs to a different profile
    
                // Clear the profile id, generate a new Anonymous id, and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ClearSavedProfileID();
                BrainCloudClient.Get().AuthenticationService.AnonymousId =
                    BrainCloudClient.Get().AuthenticationService.GenerateAnonymousId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateAnonymous(true, OnSuccess_Authenticate, OnError_AuthenticateAnonymous);
                break;
            }
            case ReasonCodes.SECURITY_ERROR: { // Identity is invalid
                // Generate a new Anonymous id, and re-authenticate
                BrainCloudClient.Get().AuthenticationService.AnonymousId =
                    BrainCloudClient.Get().AuthenticationService.GenerateAnonymousId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateAnonymous(true, OnSuccess_Authenticate, OnError_AuthenticateAnonymous);
                break;
            }
            case ReasonCodes.MISSING_REQUIRED_PARAMETER: { // Anonymous id cannot be blank
                // Generate an Anonymous id before calling AuthenticateAnonymous
                BrainCloudClient.Get().AuthenticationService.AnonymousId =
                    BrainCloudClient.Get().AuthenticationService.GenerateAnonymousId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateAnonymous(true, OnSuccess_Authenticate, OnError_AuthenticateAnonymous);
                break;
            }
            default: { // Uncaught reasonCode
                /**
                 * Log the unexpected reasonCode to your own internal logs,
                 * to implement needed error handling later
                 */
                break;
            }
        }
    }
    
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR Both an anonymousId and profileId were provided for authentication - but the anonymousId doesn't exist on the server. The profileId may or may not exist. It is possible that the user account was deleted via the Design Portal. The proper recourse is to reset the stored profile id, and re-authenticate. [There is no need to delete the anonymousId since it doesn't exist on the server anyway.]
    40207 SWITCHING_PROFILES This means that the anonymousId provided does point to a profile, but not the same one that was saved in the client. This fails the anonymous security check. For any other authentication type, this might indicate that the user wants to switch accounts (thus the name of the error constant). For anonymous, the only response is to reset both the stored anonymousId and profileId, and then re-authenticate.
    40208 MISSING_PROFILE_ERROR The anonymousId provided is not associated with an existing profile and forceCreate = false. To create an account, retry with forceCreate = true.
    40209 SECURITY_ERROR Occurs when attempting to authenticate anonymously to an existing user without providing the matching profile ID
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred on authentication
    40358 MISSING_REQUIRED_PARAMETER The provided anonymous ID cannot be null

    AuthenticateEmailPassword

    string email = "someEmail@somedomain.com";
    string password = "userPassword";
    
    _bc.AuthenticationService.AuthenticateEmailPassword(
        email, password, true, SuccessCallback, FailureCallback);
    
    const char* email = "someEmail@somedomain.com";
    const char* password = "userPassword";
    
    _bc->getAuthenticationService()->authenticateEmailPassword(
        email,
        password,
        true,
        this);
    
    NSString * email = @"someEmail@somedomain.com";
    NSString * password = @"userPassword";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
            authenticateEmailPassword:password
                     password:matchId
                  forceCreate:forceCreate
              completionBlock:successBlock
         errorCompletionBlock:failureBlock
                     cbObject:nil];
    
    public void authenticateEmailPassword(String email, String password, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateEmailPassword = function(email, password, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user with a custom Email and Password. Note that the client app is responsible for collecting (and storing) the e-mail and potentially password (for convenience) in the client data. For the greatest security, force the user to re-enter their password at each login (or at least give them that option).

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    email The e-mail address of the user
    password The password of the user
    forceCreate Should a new profile be created for this user if the account does not exist?
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: { // Identity does not exist (and client has orphaned profileId)
    
                // Reset profileId and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ResetStoredProfileId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateEmail(email, password, true);
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: { // Identity belongs to a different profile
    
                // Reset profileId and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ResetStoredProfileId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateEmail(email, password, forceCreate);
                break;
            }
            case ReasonCodes.MISSING_PROFILE_ERROR: { // Identity does not exist
    
                // The account doesn't exist - create it now.
                BrainCloudClient.Get().AuthenticationService.AuthenticateEmail(email, password, true);
                break;
            }
            case ReasonCodes.TOKEN_DOES_NOT_MATCH_USER: { // User auth information is incorrect
    
                // Display a dialog telling the user that the password provided was invalid,
                // and invite them to re-enter the password.
                // ...
                break;
            }
            default: { // Uncaught reasonCode
    
                // Log the error for debugging later
                // ...
                break;
            }
        }
    }
    
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Most often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user's password is incorrect.

    AuthenticateExternal

    string userId = "externalId";
    string token = "externalTokenOrPassword";
    string externalAuthName = "nameOfExternalAuthService";
    
    _bc.AuthenticationService.AuthenticateExternal(
        userId, token, externalAuthName, true,
        SuccessCallback, FailureCallback);
    
    const char* userId = "externalId";
    const char* token = "externalTokenOrPassword";
    const char* externalAuthName = "nameOfExternalAuthService";
    
    _bc->getAuthenticationService()->authenticateExternal(
        userId,
        token,
        externalAuthName,
        true,
        this);
    
    NSString * userID = @"externalId";
    NSString * token = @"externalTokenOrPassword";
    NSString * externalAuthName = @"nameOfExternalAuthService";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
                authenticateExternal:userID
                 authenticationToken:authToken
          externalAuthenticationName:externalAuthName
                         forceCreate:forceCreate
                     completionBlock:successBlock
                errorCompletionBlock:failureBlock
                            cbObject:nil];
    
    public void authenticateExternal(String userId,
        String token,
        String externalAuthName,
        boolean forceCreate,
        IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateExternal = function(userId, token, externalAuthName, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user via cloud code (which in turn validates the supplied credentials against an external system). This allows the developer to extend brainCloud authentication to support other backend authentication systems.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The userId
    token The user token (password etc)
    externalAuthName The name of the cloud script to call for external authentication
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials don't match (according to the 3rd party system). May also indicate an issue with the external authentication script.

    AuthenticateFacebook

    string facebookId = "userFacebookId";
    string token = "tokenFromFacebook";
    
    _bc.AuthenticationService.AuthenticateFacebook(
        facebookId, token, true, SuccessCallback, FailureCallback);
    
    const char* facebookId = "userFacebookId";
    const char* token = "tokenFromFacebook";
    
    _bc->getAuthenticationService()->authenticateFacebook(
        userId,
        token,
        true,
        this);
    
    NSString * externalID = @"userFacebookId";
    NSString * authToken = @"tokenFromFacebook";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
               authenticateFacebook:externalID
                authenticationToken:authToken
                        forceCreate:forceCreate
                    completionBlock:successBlock
               errorCompletionBlock:failureBlock
                           cbObject:nil];
    
    public void authenticateFacebook(String fbUserId, String fbAuthToken, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateFacebook = function(facebookId, facebookToken, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user with brainCloud using their Facebook Credentials.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The userId
    facebookId The Facebook ID of the user
    facebookToken The validated token from the Facebook SDK
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Facebook id / token). May also indicate that Facebook integration is not properly configured.

    AuthenticateGameCenter

    string gameCenterId = "userGameCenterId";
    
    _bc.AuthenticationService.AuthenticateGameCenter(
        gameCenterId, true, SuccessCallback, FailureCallback);
    
    const char* gameCenterId = "userGameCenterId";
    
    _bc->getAuthenticationService()->authenticateGameCenter(
        gameCenterId,
        true,
        this);
    
    NSString * gameCenterID = @"userGameCenterId";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
             authenticateGameCenter:gameCenterID
                        forceCreate:forceCreate
                    completionBlock:successBlock
               errorCompletionBlock:failureBlock
                           cbObject:nil];
    
    // N/A
    
    brainCloudClient.authentication.authenticateGameCenter = function(gameCenterId, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user using their Game Center ID.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    gameCenterId The player's game center ID (use the playerID property from the local GKPlayer object)
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the design portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad gameCenterId)

    AuthenticateGoogle

    string googleId = "myUser@gmail.com";
    string token = "authTokenFromGoogle";
    
    _bc.AuthenticationService.AuthenticateGoogle(
        googleId, token, true, SuccessCallback, FailureCallback);
    
    const char* googleId = "myUser@gmail.com";
    const char* token = "authTokenFromGoogle";
    
    _bc->getAuthenticationService()->authenticateGoogle(
        googleId, token, true, this);
    
    NSString * userID = @"myUser@gmail.com";
    NSString * token = @"authTokenFromGoogle";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
             authenticateGoogle:userID
            authenticationToken:authToken
                    forceCreate:forceCreate
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    public void authenticateGoogle(String googleUserId, String googleAuthToken, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateGoogle = function(googleId, googleToken, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user using a google user ID (email address) and google authentication token.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    googleId String representation of google+ userid (email)
    googleToken The authentication token derived via the google apis.
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. googleId and googleToken are invalid). May also indicate that Google Integration is not properly configured.

    AuthenticateParse

    string parseId = "someId1234";
    string token = "authToken";
    
    _bc.AuthenticationService.AuthenticateParse(
        parseId, token, true, SuccessCallback, FailureCallback);
    
    const char* parseId = "someId1234";
    const char* token = "authToken";
    
    _bc->getAuthenticationService()->authenticateParse(
        parseId, token, true, this);
    
    NSString * userID = @"someId1234";
    NSString * authToken = @"authToken";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
              authenticateParse:userID
                          token:authToken
                    forceCreate:forceCreate
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    public void authenticateParse(String parseUserId, String parseAuthToken, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateParse = function(parseId, parseToken, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user using a Parse user ID and authentication token.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    parseId String representation of Parse user ID
    parseToken The authentication token from Parse
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. parseId and parseToken are invalid). May also indicate that Parse Integration is not properly configured.

    AuthenticateSteam

    string steamId = "userSteamId";
    string ticket = "sessionTicketFromSteam";
    
    _bc.AuthenticationService.AuthenticateSteam(
        steamId, ticket, true, SuccessCallback, FailureCallback);
    
    const char* steamId = "userSteamId";
    const char* ticket = "sessionTicketFromSteam";
    
    _bc->getAuthenticationService()->authenticateSteam(
        steamId, token, true, this);
    
    NSString * steamId = @"userSteamId";
    NSString * ticket = @"sessionTicketFromSteam";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
              authenticateSteam:steamId
                  sessionTicket:ticket
                    forceCreate:forceCreate
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    public void authenticateSteam(String steamUserId, String steamSessionTicket, boolean forceCreate, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateSteam = function(userId, sessionTicket, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user using a steam userId and session ticket (without any validation on the userId).

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId String representation of 64 bit steam ID
    sessionTicket The session ticket of the user (hex encoded)
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Steam userId and/or sessionTicket). May also indicate that Steam Integration is not properly configured.

    AuthenticateTwitter

    string twitterId = "userTwitterId";
    string token = "userAuthToken";
    string secret = "secretFromTwitterApi";
    
    _bc.AuthenticationService.AuthenticateTwitter(
        twitterId, token, secret, true, SuccessCallback, FailureCallback);
    
    const char* twitterId = "userTwitterId";
    const char* token = "userAuthToken";
    const char* secret = "secretFromTwitterApi";
    
    _bc->getAuthenticationService()->authenticateTwitter(
        twitterId, token, secret, true, this);
    
    NSString * twitterId = @"userTwitterId";
    NSString * token = @"userAuthToken";
    NSString * secret = @"secretFromTwitterApi";
    BOOL forceCreate = true;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc authenticationService]
            authenticateTwitter:twitterId
                          token:token
                          secret:secret
                     forceCreate:forceCreate
                 completionBlock:successBlock
            errorCompletionBlock:failureBlock
                        cbObject:nil];
    
    public void authenticateTwitter(String userId,
                                    String token,
                                    String secret,
                                    boolean forceCreate,
                                    IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.authenticateTwitter = function(userId, token, secret, forceCreate, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Authenticate the user using a Twitter user ID, authentication token, and secret from Twitter.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId String representation of Twitter user ID
    token The authentication token derived via the Twitter APIs
    secret The secret given when attempting to link with Twitter
    forceCreate Should a new profile be created for this user if the account does not exist?
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [but un-associated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the provided profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials are invalid (i.e. bad Twitter userId / token / secret). May also indicate that Twitter integration is not properly configured.

    AuthenticateUniversal

    const char* userId = "Username";
    const char* password = "passwrd123";
    
    if (newUser)
    {
        _bc->getAuthenticationService()->authenticateUniversal(userId, password, true, callback);
    }
    else
    {
        _bc->getAuthenticationService()->authenticateAnonymous(userId, password, false, callback);
    }
    
    // note you can also use the BrainCloudWrapper class
    
    _bc.AuthenticationService.AuthenticateUniversal(userId, password, SuccessCallback, FailureCallback);
    
    BrainCloudClient.GetInstance().GetAuthenticationService().AuthenticateUniversal(userId, password, SuccessCallback, FailureCallback, cbObject);
    
    NSString* userId = "UserId";
    NSString* password = "password";
    
    [[m_client authenticationService]
        authenticateUniversal:userId
                     password:password
                  forceCreate:true
              completionBlock:successBlock
         errorCompletionBlock:failureBlock
                     cbObject:nil];
    
    brainCloudAuthentication = function(callback)
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "vcPurchased": 0,
            "experiencePoints": 100,
            "refundCount": 0,
            "playerSessionExpiry": 60,
            "server_time": 1464621990155,
            "experienceLevel": 0,
            "currency": {
                "credits": {
                    "purchased": 0,
                    "balance": 12211,
                    "consumed": 133,
                    "awarded": 12344
                }
            },
            "abTestingId": 8,
            "statistics": {
                "gamesWon": 0
            },
            "id": "323e861-b749-4ce4-a57a-175232e21b5d",
            "createdAt": 1459439058035,
            "profileId": "323e861-b749-4ce4-a57a-175232e21b5d",
            "newUser": "false",
            "xpCapped": false,
            "sent_events": [],
            "timeZoneOffset": -5,
            "playerName": "",
            "vcClaimed": 0,
            "parentProfileId": null,
            "rewards": {
                "rewardDetails": {},
                "rewards": {},
                "currency": {}
            },
            "countryCode": "ca",
            "loginCount": 16,
            "emailAddress": "test@email.com",
            "previousLogin": 1464621979514,
            "incoming_events": [],
            "lastLogin": 1464621990118,
            "languageCode": "en",
            "pictureUrl": null,
            "sessionId": "v3grtg3ve0a089pekk8lneuk8k",
            "amountSpent": 0
        }
    }
    

    Universal authentication allows the developer to pass in any user/password string combination. As with all authentication methods, if the create new profile flag is specified as false, the authentication will fail if the user/password combination does not match a user in the database.

    Service Operation
    "authenticationV2" "AUTHENTICATE"
    Method Parameters
    Parameter Description
    userId The user's ID.
    password The password of the user.
    forceCreate If set to true, create a new profile if userId not found. If set to false and anonymous ID does not exist on the server, return an error.
    Show Example Error Handling {}
    public void FailureCallback(int statusCode, int reasonCode, string statusMessage, object cbObject) {
        switch (reasonCode) {
            case ReasonCodes.MISSING_IDENTITY_ERROR: { // Identity does not exist (and client has orphaned profileId)
    
                // Reset profileId and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ResetStoredProfileId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.SWITCHING_PROFILES: { // Identity belongs to a different profile
    
                // [Optional] Prompt user to confirm that they wish to switch accounts?
    
                // Reset profileId and re-authenticate
                BrainCloudClient.Get().AuthenticationService.ResetStoredProfileId();
                BrainCloudClient.Get().AuthenticationService.AuthenticateUniversal(userId, password, forceCreate);
                break;
            }
            case ReasonCodes.MISSING_PROFILE_ERROR: { // Identity does not exist
    
                // The account doesn't exist - create it now.
                BrainCloudClient.Get().AuthenticationService.AuthenticateUniversal(userId, password, true);
                break;
            }
            case ReasonCodes.TOKEN_DOES_NOT_MATCH_USER: { // Wrong password
    
                // Display a dialog telling the user that the password provided was invalid,
                // and invite them to re-enter the password.
                // ...
                break;
            }
            default: { // Uncaught reasonCode
    
                // Log the error for debugging later
                // ...
                break;
            }
        }
    }
    
    Error returns
    Code Name Description
    40206 MISSING_IDENTITY_ERROR The identity does not exist on the server and forceCreate was false [and a profileId was provided - otherwise 40208 would have been returned]. Will also occur when forceCreate is true and a saved [and unrelated] profileId is provided. The error handler should reset the stored profile id (if there is one) and re-authenticate, setting forceCreate to true to create a new account. A common cause of this error is deleting the user's account via the Design Portal.
    40207 SWITCHING_PROFILES Indicates that the identity credentials are valid, and the saved profileId is valid, but the identity is not associated with the profileId. This may indicate that the user wants to switch accounts in the app. Often an app will pop-up a dialog confirming that the user wants to switch accounts, and then reset the stored profileId and call authenticate again.
    40208 MISSING_PROFILE_ERROR Returned when the identity cannot be located, no profileId is provided, and forceCreate is false. The normal response is to call Authenticate again with forceCreate set to true.
    40217 UNKNOWN_AUTH_ERROR An unknown error has occurred during authentication.
    40307 TOKEN_DOES_NOT_MATCH_USER The user credentials don't match (i.e. incorrect password).

    ClearSavedProfileId

    _bc.AuthenticationService.ClearSavedProfileID();
    
    _bc->getAuthenticationService()->clearSavedProfileID();
    
    [[_bc authenticationService] clearSavedProfile];
    
    public void clearSavedProfileId();
    
    brainCloudClient.authentication.clearSavedProfileId();
    
    // N/A
    

    Used to clear the saved profile ID - to use in cases when the user is attempting to switch to a different game profile.

    GenerateAnonymousId

    string anonId = _bc.AuthenticationService.GenerateAnonymousId();
    
    std::string anonId = _bc->getAuthenticationService()->generateAnonymousId();
    
    NSString * anonId = [[_bc authenticationService] generateAnonymousId];
    
    String anonId = _bc.getAuthenticationService().generateAnonymousId();
    
    var anonId = brainCloudClient.authentication.generateAnonymousId();
    
    // N/A
    

    Generates a GUID for use as an anonymous installation ID for brainCloud. Normally only called once when the application starts for the first time.

    The generated ID is used in conjunction with InitializeIdentity in the BrainCloudClient.

    Initialize

    _bc.AuthenticationService.Initialize("profileId", "anonId");
    
    _bc->getAuthenticationService()->initialize("profileId", "anonId");
    
    NSString * profileID = @"profileId";
    NSString * anonymousID = @"anonId";
    
    [[_bc authenticationService]
                    initialize:profileID
                   anonymousID:anonymousID];
    
    public void initialize(String profileId, String anonymousId);
    
    brainCloudClient.authentication.initialize(profileId, anonymousId);
    
    // N/A
    

    Initializes the authentication service with an anonymous installation ID and most recently used profile ID. You will need to call this method before authenticating anonymously.

    Note that calling this is the same as calling InitializeIdentity in the BrainCloudClient.

    Method Parameters
    Parameter Description
    profileId The ID of the profile ID that was most recently used by the app (on this device)
    anonymousId The anonymous installation ID that was generated for this device

    ResetEmailPassword

    string email = "userEmail@somedomain.com";
    
    _bc.AuthenticationService.ResetEmailPassword(
        email, ApiSuccess, ApiError)
    
    const char* email = "userEmail@somedomain.com";
    
    _bc->getAuthenticationService()->resetEmailPassword(email, this);
    
    NSString * email = @"userEmail@somedomain.com";
    
    [[_bc authenticationService]
                 resetEmailPassword:email
                    completionBlock:successBlock
                   errorCompletionBlock:failureBlock
                               cbObject:nil];
    
    public void resetEmailPassword(String email, IAuthenticationServiceCallback callback)
    
    brainCloudClient.authentication.resetEmailPassword = function(email, responseHandler)
    
    // N/A
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Sends a password reset email to the specified address.

    Service Operation
    "authenticationV2" "RESET_EMAIL_PASSWORD"
    Method Parameters
    Parameter Description
    email The email address to send the reset email to.

    Async Match

    Many mobile games today feature a type of multiplayer game capability known as asynchronous or turn-based gaming. This is where player #1 would take a turn, then player #2 is notified that it is their turn (via push notification). Player #2 would then take their turn and player #1 is then notified it is again their turn and so on until the game is completed (think of playing a game of chess via mail).

    This page describes the design used to facilitate this type of multiplayer game within brainCloud.

    Match Lifecycle

    An Async Match can exist in four states that define where it is in its lifecycle. Certain operations are only supported in specific states.

    The current state is returned in the "status" field of the match data.

    NOT_STARTED

    A match has been created but has not had any turns submitted. A match in this state cannot be completed (status set to COMPLETE).

    PENDING

    The match has had at least one turn submitted.

    COMPLETE

    A match that has been explicitly completed via the CompleteMatch API. A match cannot be completed if its current status is NOT_STARTED.

    EXPIRED

    A match that has been explicitly abandoned via the AbandonMatch API. A match cannot be abandoned if its current status is COMPLETE.

    Data Model

    The following diagram illustrates the data model implemented in brainCloud to support this feature:

    Async Match Data Model

    Match Entity

    The Match entity represents a single asynchronous match between two or more players (for example a single game of chess or tic-tac-toe).

    MatchHistory Entity

    The MatchHistory entity represents the turn-by-turn history of the state related to a particular match.

    Player Entity

    The Player entity represents the actual player. We are simply using the "lastLogin" attribute to identify those Player's that have been pre-created by the AsyncMatchService (by checking if the "lastLogin" field is NULL).

    Summary

    Match Management
    Turns
    Match Data

    AbandonMatch

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->abandonMatch(
        ownerProfileId,
        matchId,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //Step 3:   Now, you can call AbandonMatch
    
    string ownerId = "3c4db48d-54a4-433d-a273-4ada1709d239";
    string matchId = "3b88a820-3d0a-4fbb-b1ab-7fab20ab69c4";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[AbandonMatch Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[AbandonMatch Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.AbandonMatch(
        ownerId,
        matchId,
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .abandonMatch(ownerProfileId,
                        matchId,
                        this);
    
    NSString * profileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
              abandonMatch:profileId
                   matchId:matchId
           completionBlock:successBlock
      errorCompletionBlock:failureBlock
                  cbObject:nil];
    
    var profileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.abandonMatch(profileId, matchId, callback);
    
    var profileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.abandonMatch(profileId, matchId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Marks the given match as abandoned and sets the matchState to EXPIRED.

    Service Operation
    "asyncMatch" "ABANDON"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier

    CompleteMatch

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->completeMatch(
        ownerProfileId,
        matchId,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //Step 3:   Now, you can call CompleteMatch
    
    string ownerId = "3c4db48d-54a4-433d-a273-4ada1709d239";
    string matchId = "3b88a820-3d0a-4fbb-b1ab-7fab20ab69c4";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[CompleteMatch Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[CompleteMatch Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.CompleteMatch(
        ownerId,
        matchId,
        successCallback, failureCallback);
    
    String profileId = "1234-1234-1234-1234";
    int matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .completeMatch(profleId, matchId, this);
    
    
    NSString * profileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
            completeMatch:profileId
                  matchId:matchId
          completionBlock:successBlock
     errorCompletionBlock:failureBlock
                 cbObject:nil];
    
    var profileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.completeMatch(profileId, matchId, callback);
    
    var ownerId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.completeMatch(ownerId, matchId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Marks the given match as complete.

    Service Operation
    "asyncMatch" "COMPLETE"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier

    CreateMatch

    const char* playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    const char* notificationMessage = "You've been challenged!";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->createMatch(
        playersJson,
        notificationMessage,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Find one or more opponent playerId to match against
    //          http://getbraincloud.com/apidocs/apiref/#capi-matchmaking-findplayers
    //          Get the preferred playerId(s) from the response
    //Step 3:   Now, you can call CreateMatch
    
    string jsonOpponentIds = "[ { \"platform\": \"BC\", \"id\": \"d2136ec1-3279-4820-bc88-a2b5602d7399\" } ]": // Matching against one player
    string jsonOpponentIds = "[ { \"platform\": \"BC\", \"id\": \"d2136ec1-3279-4820-bc88-a2b5602d7399\" }, { \"platform\": \"BC\", \"id\": \"a2eb1928-0ea9-4f50-a792-7e4d2dfd1dbd\" }, { \"platform\": \"BC\", \"id\": \"1dd71940-2806-4777-9142-b2ebe836be30\" } ]": // Matching against three players
    string pushNotificationMessage = "You've been challenged!";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[CreateMatch Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[CreateMatch Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.CreateMatch(
        jsonOpponentIds,
        pushNotificationMessage,
        successCallback, failureCallback);
    
    String playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    String pushNotificationMessage = "You've been challenged!";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .createMatch(playersJson,
                        pushNotificationMessage,
                        this);
    
    NSString * playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    NSString * pushNotificationMessage = @"You've been challenged!";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
                    createMatch:playersJson
        pushNotificationMessage:pushMessage
                completionBlock:successCallback
           errorCompletionBlock:failureCallback
                       cbObject:nil];
    
    var playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    var pushNotificationMessage = "You've been challenged!";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.createMatch(playersJson, pushNotificationMessage, callback);
    
    var players = [ { "platform": "BC", "id": "1234-1234-1234-1234" } ];
    var notificationMessage = "Push message";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.createMatch(players, notificationMessage);
    
    Show Example JSON Return {}
    {
        "status" : 200,
        "data" :
        {
            "gameId": "com.dnadpk.football",
            "ownerId": "0df9f282-183b-4d67-866e-670fb35a2376",
            "matchId": "match1",
            "version": 0,
            "players": [
                {
                    "playerId": "0df9f282-183b-4d67-866e-670fb35a2376",
                    "playerName": "",
                    "pictureUrl": null
                },
                {
                    "playerId": "4693ec75-3a99-4577-aef7-0f41d299339c",
                    "playerName": "Presto1",
                    "pictureUrl": null
                }
            ],
            "status": {
                "status": "NOT_STARTED",
                "currentPlayer": "0df9f282-183b-4d67-866e-670fb35a2376"
            },
            "summary": null,
            "createdAt": 1415641372974,
            "updatedAt": 1415641372974
        }
    }
    

    Creates an instance of an asynchronous match.

    Opponents is a JSON array containing objects with a Platform and player ID. Platforms are identified as:

    An example of this string would be:

    [{ "platform":"BC", "id": "some-braincloud-profile" }, { "platform":"FB", "id": "some-facebook-id" }]

    Service Operation
    "asyncMatch" "CREATE"
    Method Parameters
    Parameter Description
    jsonOpponentIds List of objects identifying the opponent platform and id for this match.
    pushNotificationMessage Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.

    CreateMatchWithInitialTurn

    const char* playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    const char* matchStateJson; // { "level" : 01 }
    const char* notificationMessage = "Push message";
    const char* opponentId = "1234-1234-1234-1234";
    const char* matchSummaryJson; // { "teamPoints" : 22 }
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->createMatchWithInitialTurn(
        playersJson,
        matchStateJson,
        notificationMessage,
        opponentId,
        matchSummaryJson,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Find one or more opponent playerId to match against
    //          http://getbraincloud.com/apidocs/apiref/#capi-matchmaking-findplayers
    //          Get the preferred playerId(s) from the response
    //Step 3:   Now, you can call CreateMatchWithInitialTurn
    
    string jsonOpponentIds = "[ { \"platform\": \"BC\", \"id\": \"d2136ec1-3279-4820-bc88-a2b5602d7399\" } ]": // Matching against one player
    string jsonOpponentIds = "[ { \"platform\": \"BC\", \"id\": \"d2136ec1-3279-4820-bc88-a2b5602d7399\" }, { \"platform\": \"BC\", \"id\": \"a2eb1928-0ea9-4f50-a792-7e4d2dfd1dbd\" }, { \"platform\": \"BC\", \"id\": \"1dd71940-2806-4777-9142-b2ebe836be30\" } ]": // Matching against three players
    string jsonMatchState = "{ \"level\": 0 , \"moves\" : [ {\"type\":\"strong\"},{\"type\":\"weak\"}] }";
    string pushNotificationMessage = "You've been matched!";
    string nextPlayer = "d2136ec1-3279-4820-bc88-a2b5602d7399";
    string jsonSummary = "{ \"state\" : \"minor_damage\" }";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[CreateMatchWithInitialTurn Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[CreateMatchWithInitialTurn Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.CreateMatchWithInitialTurn(
        jsonOpponentIds,
        jsonMatchState,
        pushNotificationMessage,
        nextPlayer,
        jsonSummary,
        successCallback, failureCallback);
    
    String playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    String matchStateJson; // { "level" : 01 }
    String notificationMessage = "Push message";
    String opponentId = "1234-1234-1234-1234";
    String matchSummaryJson; // { "teamPoints" : 22 }
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .createMatchWithInitialTurn(playersJson,
                                      jsonMatchState,
                                      pushNotificationMessage,
                                      nextPlayer,
                                      jsonSummary,
                                      this);
    
    NSString * playersJson; // [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    NSString * matchStateJson; // { "level" : 01 }
    NSString * notificationMessage = "Push message";
    NSString * opponentId = @"1234-1234-1234-1234";
    NSString * matchSummaryJson; // { "teamPoints" : 22 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
            createMatchWithInitialTurn:playersJson
                        jsonMatchState:matchState
               pushNotificationMessage:pushMessage
                            nextPlayer:opponentId
                           jsonSummary:matchSummaryJson
                       completionBlock:successCallback
                  errorCompletionBlockfailurecallBack
                              cbObject:nil];
    
    var playersJson = [ { "platform": "BC", "id": "1234-1234-1234-1234" } ]
    var matchStateJson = { "level" : 01 }
    var notificationMessage = "Push message";
    var opponentId = "1234-1234-1234-1234";
    var matchSummaryJson = { "teamPoints" : 22 }
    function callback; // define callback
    
    brainCloudClient.asyncMatch
            .createMatchWithInitialTurn(playersJson,
                                        matchStateJson,
                                        pushNotificationMessage,
                                        nextPlayer,
                                        summary,
                                        callback);
    
    var players = [ { "platform": "BC", "id": "1234-1234-1234-1234" } ];
    var matchState = { "something" : 1234 };
    var notificationMessage = "Push message";
    var nextPlayer = null;
    var summary = { "something" : 1234 };
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.createMatchWithInitialTurn(players, matchState, notificationMessage, nextPlayer, summary);
    
    Show Example JSON Return {}
    {
        "data" : {
            "createdAt" : 1449737412088,
            "gameId" : "102345",
            "matchId" : "af876cc7-1dd1-4fbe-959d-a9awdsab9a1c",
            "ownerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
            "players" : [
                {
                    "pictureUrl" : null,
                    "playerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
                    "playerName" : "UserA_CPP_96764398"
                },
                {
                    "pictureUrl" : null,
                    "playerId" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
                    "playerName" : "UserB_CPP_80148460"
                }
            ],
            "status" : {
                "currentPlayer" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
                "status" : "PENDING"
            },
            "summary" : {
                "map" : "level01"
            },
            "updatedAt" : 1449737412092,
            "version" : 1
        },
        "status" : 200
    }
    

    Creates an instance of an asynchronous match with an initial turn.

    Opponent IDs is a JSON array containing objects with a Platform and player ID. Platforms are identified as:

    An example of this string would be:

    [{ "platform":"BC", "id": "some-braincloud-profile" }, { "platform":"FB", "id": "some-facebook-id" }]

    Service Operation
    "asyncMatch" "CREATE"
    Method Parameters
    Parameter Description
    jsonOpponentIds List of objects identifying the opponent platform and id for this match.
    jsonMatchState JSON string blob provided by the caller
    pushNotificationMessage Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.
    nextPlayer Optionally, force the next player player to be a specific player
    jsonSummary Optional JSON string defining what the other player will see as a summary of the game when listing their games

    DeleteMatch

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->deleteMatch(
        ownerProfileId,
        matchId,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Find one or more completed matches
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-findcompletematches
    //          Get the preferred ownerId(s) and matchId(s) from the response
    //          Note: The matches do not have to be *completed* any match type can be deleted
    //Step 3:   Now, you can call DeleteMatch
    
    string ownerProfileId = "9ad4f990-5466-4d00-a334-de834e1ac4ec";
    string matchId = "877dd25d-ea21-4857-ba2a-2134d0f5ace2;
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[DeleteMatch Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[DeleteMatch Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.DeleteMatch(
        ownerProfileId,
        matchId,
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .deleteMatch(ownerProfileId, matchId, this);
    
    NSString * ownerProfileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
              deleteMatch:ownerProfileId
                  matchId:matchId
          completionBlock:successBlock
     errorCompletionBlock:failureBlock
                 cbObject:nil];
    
    var ownerProfileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.deleteMatch(ownerProfileId, matchId, callback);
    
    var ownerId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.deleteMatch(ownerId, matchId);
    
    Show Example JSON Return {}
    {
     "status": 200,
     "data": null
    }
    

    Removes the match and match history from the server.

    Service Operation
    "asyncMatch" "DELETE_MATCH"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier

    FindCompleteMatches

    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->findCompleteMatches(this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a completed match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-completematch
    //          Should have a 200 success status returned
    //          Note: If you do not have a completed match, you will get a blank results list when calling FindCompleteMatches.
    //Step 3:   Now, you can call FindCompleteMatches
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[FindCompleteMatches Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[FindCompleteMatches Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.FindCompleteMatches(
        successCallback, failureCallback);
    
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .findCompleteMatches(callback);
    
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
            findCompleteMatches:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    function callback; // define callback
    
    brainCloudClient.asyncMatch.findCompleteMatches(callback);
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.findCompleteMatches();
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "results": [
                {
                    "gameId": "109999",
                    "ownerId": "9ad4f990-5466-4d00-a334-de834e1ac4ec",
                    "matchId": "877dd25d-ea21-4857-ba2a-2134d0f5ace2",
                    "version": 2,
                    "players": [
                        {
                            "playerId": "9ad4f990-5466-4d00-a334-de834e1ac4ec",
                            "playerName": "",
                            "pictureUrl": null
                        },
                        {
                            "playerId": "963a2079-6e7a-48de-a4f2-8ab16c811975",
                            "playerName": "",
                            "pictureUrl": null
                        }
                    ],
                    "status": {
                        "status": "COMPLETE",
                        "currentPlayer": "963a2079-6e7a-48de-a4f2-8ab16c811975"
                    },
                    "summary": null,
                    "createdAt": 1442586358023,
                    "updatedAt": 1442586374787
                }
            ]
        }
    }
    

    Returns all matches that are in a COMPLETE state for which the player is involved.

    Service Operation
    "asyncMatch" "FIND_MATCHES_COMPLETED"

    FindMatches

    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->findMatches(this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //          Note: The opposing player can also create the match.
    //Step 3:   Now, you can call FindMatches
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[FindMatches Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[FindMatches Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.FindMatches(
        successCallback, failureCallback);
    
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .findMatches(callback);
    
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
                   findMatches:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    function callback; // define callback
    
    brainCloudClient.asyncMatch.findMatches(callback);
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.findMatches();
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "results": [
                {
                    "gameId": "123456",
                    "ownerId": "7630f98e-1236-4ead-88ee-27ce63b2db2c",
                    "matchId": "97c8d087-40d8-45c2-aa2b-6d0d83424ec5",
                    "version": 1,
                    "players": [
                        {
                            "playerId": "7630f98e-13b6-4ead-88ee-27ce63b2db2c",
                            "playerName": "UserA-122217922",
                            "pictureUrl": null
                        },
                        {
                            "playerId": "b28ff14a-364a-40b3-ac4e-d2b23983519c",
                            "playerName": "UserC-338593317",
                            "pictureUrl": null
                        }
                    ],
                    "status": {
                        "status": "PENDING",
                        "currentPlayer": "efab2d0b-90a1-48cf-8678-ae81d7aaed89"
                    },
                    "summary": null,
                    "createdAt": 1442586020180,
                    "updatedAt": 1442586020188
                }
            ]
        }
    }
    

    Returns all matches that are NOT in a COMPLETE state for which the player is involved.

    Service Operation
    "asyncMatch" "FIND_MATCHES"

    ReadMatch

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->readMatch(
        ownerProfileId,
        matchId,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //          Note: The opposing player can also create the match.
    //Step 3:   Now, you can call ReadMatch
    
    string ownerProfileId = "35e8698f-b14d-48ae-a37c-4b2962308b8d";
    string matchId = "cfa752d6-d408-4671-9603-b22bf55d5379";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[ReadMatch Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[ReadMatch Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.ReadMatch(
        ownerProfileId,
        matchId
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .readMatch(ownerProfileId, matchId, callback);
    
    NSString * ownerProfileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
                readMatch:ownerProfileId
                  matchId:matchId
          completionBlock:successBlock
     errorCompletionBlock:failureBlock
                 cbObject:nil];
    
    var ownerProfileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.readMatch(ownerProfileId, matchId, callback);
    
    var ownerId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.readMatch(ownerId, matchId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "gameId": "11004",
            "ownerId": "35e8698f-b14d-48ae-a37c-4b2962308b8d",
            "matchId": "cfa752d6-d408-4671-9603-b22bf55d5379",
            "version": 1,
            "players": [{
                "playerId": "35e8698f-b14d-48ae-a37c-4b2962308b8d",
                "playerName": "",
                "pictureUrl": null
            }, {
                "playerId": "e84c16ea-bd62-4307-83f9-d32f8ac18bca",
                "playerName": "",
                "pictureUrl": null
            }],
            "status": {
                "status": "PENDING",
                "currentPlayer": "e84c16ea-bd62-4307-83f9-d32f8ac18bca"
            },
            "summary": null,
            "statistics": {},
            "matchState": {
                "testKey": "testValue"
            },
            "createdAt": 1472293357985,
            "updatedAt": 1472293357996
        }
    }
    

    Returns the current state of the given match.

    Service Operation
    "asyncMatch" "READ_MATCH"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier

    ReadMatchHistory

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->readMatchHistory(
        ownerProfileId,
        matchId,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //          Note: The opposing player can also create the match.
    //Step 3:   Now, you can call ReadMatchHistory
    
    string ownerProfileId = "35e8698f-b14d-48ae-a37c-4b2962308b8d";
    string matchId = "cfa752d6-d408-4671-9603-b22bf55d5379";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[ReadMatchHistory Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[ReadMatchHistory Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.ReadMatchHistory(
        ownerProfileId,
        matchId
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .readMatchHistory(ownerProfileId, matchId, callback);
    
    NSString * ownerProfileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
          readMatchHistory:ownerProfileId
                   matchId:matchId
           completionBlock:successCallback
      errorCompletionBlock:failureCallback
                  cbObject:nil];
    
    var ownerProfileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    function callback; // define callback
    
    brainCloudClient.asyncMatch.readMatchHistory(ownerProfileId, matchId, callback);
    
    var ownerId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.readMatchHistory(ownerId, matchId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "gameId": "14577",
            "ownerId": "2bd32bc6-c2ec-4916-a1a8-02b7a38540ad",
            "matchId": "1aac24b2-7976-4fd7-b7c6-44d32e6d26a4",
            "turns": [
                {
                    "playerId": "2bd32bc6-c2ec-4916-a1a8-02b7a38540ad",
                    "matchState": {
                        "color": "red"
                    },
                    "createdAt": 1442507319697
                },
                {
                    "playerId": "11c9324d-9ed1-416d-b124-5228c1efafac",
                    "matchState": {},
                    "createdAt": 1442507703667
                }
            ]
        }
    }
    

    Returns the match history of the given match.

    Service Operation
    "asyncMatch" "READ_MATCH_HISTORY"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier

    SubmitTurn

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    uint64_t matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    const char* matchStateJson; // { "level" : 01 }
    const char* notificationMessage = "Push message";
    const char* matchSummaryJson; // { "teamPoints" : 22 }
    const char* matchStatsJson; // { "points " : 22 }
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->submitTurn(
        ownerProfileId,
        matchId,
        matchVersion,
        matchStateJson,
        notificationMessage,
        NULL, //let the server pick the next player automatically
        matchSummaryJson,
        matchStatsJson,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //          Note: The opposing player can also create the match.
    //Step 3:   Now, you can call SubmitTurn
    
    string ownerProfileId = "35e8698f-b14d-48ae-a37c-4b2962308b8d";
    string matchId = "cfa752d6-d408-4671-9603-b22bf55d5379";
    ulong matchVersion = 2; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    string jsonMatchState = "{ \"level\": 0 , \"moves\" : [ {\"type\":\"strong\"},{\"type\":\"weak\"}] }";
    string pushNotificationMessage = "It's now your turn!";
    string nextPlayer = "d2136ec1-3279-4820-bc88-a2b5602d7399"; // or use null to let the server pick the next player automatically
    string jsonSummary = "{ \"state\" : \"minor_damage\" }";
    string jsonStatistics = "{ \"points\" : 30 }";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[SubmitTurn Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[SubmitTurn Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.SubmitTurn(
        ownerProfileId,
        matchId,
        matchVersion,
        jsonMatchState,
        pushNotificationMessage,
        nextPlayer, 
        jsonSummary,
        jsonStatistics,
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    BigInteger matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    String matchStateJson; // { "level" : 01 }
    String notificationMessage = "Push message";
    String matchSummaryJson; // { "teamPoints" : 22 }
    String matchStatsJson; // { "points " : 22 }
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
        .submitTurn(
        ownerProfileId,
        matchId,
        matchVersion,
        jsonMatchState,
        notificationMessage,
        null, //let the server pick the next player automatically
        matchSummaryJson,
        matchStatsJson,
        this);
    
    NSString * ownerProfileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    uint64_t matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    NSString * matchStateJson; // { "level" : 01 }
    NSString * notificationMessage = "Push message";
    NSString * matchSummaryJson; // { "teamPoints" : 22 }
    NSString * matchStatsJson; // { "points " : 22 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
                     submitTurn:ownerProfileId
                        matchId:matchId
                        version:matchVersion
                 jsonMatchState:matchState
        pushNotificationMessage:notificationMessage
                     nextPlayer:nil, //let the server pick the next player automatically
                    jsonSummary:matchSummaryJson
                 jsonStatistics:matchStatsJson
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    string ownerId = "1234-1234-1234-1234";
    string matchId = "1234-1234-1234-1234";
    var version = 1;
    var matchState = { "something" : 1234 };
    var notificationMessage = "Push message";
    var nextPlayer = null; //let the server pick the next player automatically
    var summary = { "something" : 1234 };
    var stats = { "something" : 1234 };
    
    brainCloudClient.asyncMatch.submitTurn(ownerId,
                                           matchId,
                                           version,
                                           matchState,
                                           pushNotificationMessage,
                                           nextPlayer,
                                           summary,
                                           statistics);
    
    string ownerId = "1234-1234-1234-1234";
    string matchId = "1234-1234-1234-1234";
    var version = 1;
    var matchState = { "something" : 1234 };
    var notificationMessage = "Push message";
    var nextPlayer = null;
    var summary = { "something" : 1234 };
    var stats = { "something" : 1234 };
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.submitTurn(ownerId, matchId, version, matchState,
        notificationMessage, nextPlayer, summary, stats);
    
    Show Example JSON Return {}
    {
        "data" : {
            "createdAt" : 1449737412088,
            "gameId" : "102345",
            "matchId" : "af876cc7-1dd1-4fbe-959d-a9awdsab9a1c",
            "ownerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
            "players" : [
                {
                    "pictureUrl" : null,
                    "playerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
                    "playerName" : "UserA_CPP_96764398"
                },
                {
                    "pictureUrl" : null,
                    "playerId" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
                    "playerName" : "UserB_CPP_80148460"
                }
            ],
            "status" : {
                "currentPlayer" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
                "status" : "PENDING"
            },
            "summary" : {
                "map" : "level01"
            },
            "updatedAt" : 1449737412092,
            "version" : 1
        },
        "status" : 200
    }
    

    Submits a turn for the given match.

    Service Operation
    "asyncMatch" "SUBMIT_TURN"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier
    version Game state version to ensure turns are submitted once and in order
    jsonMatchState JSON string blob provided by the caller
    pushNotificationMessage Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.
    nextPlayer Optionally, force the next player player to be a specific player
    jsonSummary Optional JSON string defining what the other player will see as a summary of the game when listing their games
    jsonStatistics Optional JSON string blob provided by the caller

    UpdateMatchSummaryData

    const char* ownerProfileId = "1234-1234-1234-1234";
    const char* matchId = "1234-1234-1234-1234";
    uint64_t matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    const char* matchSummaryJson; // { "teamPoints" : 22 }
    this; // implements IServerCallback
    
    _bc->getAsyncMatchService()->updateMatchSummaryData(
        ownerProfileId,
        matchId,
        matchVersion,
        matchSummaryJson,
        this);
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a started match
    //          http://getbraincloud.com/apidocs/apiref/#capi-asyncmatch-creatematch
    //          Get the ownerId and matchId from the response
    //Step 3:   Now, you can call UpdateMatchSummaryData
    
    string ownerProfileId = "35e8698f-b14d-48ae-a37c-4b2962308b8d";
    string matchId = "cfa752d6-d408-4671-9603-b22bf55d5379";
    ulong matchVersion = 2; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    string jsonSummary = "{ \"state\" : \"major_damage\" }";
    
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[UpdateMatchSummaryData Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[UpdateMatchSummaryData Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.AsyncMatchService.UpdateMatchSummaryData(
        ownerProfileId,
        matchId,
        matchVersion,
        jsonSummary,
        successCallback, failureCallback);
    
    String ownerProfileId = "1234-1234-1234-1234";
    String matchId = "1234-1234-1234-1234";
    BigInterget matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    String matchSummaryJson; // { "teamPoints" : 22 }
    this; // implements IServerCallback
    
    _bc.getAsyncMatchService()
          .updateMatchSummaryData(ownerProfileId,
                                  matchId,
                                  matchVersion,
                                  matchSummary,
                                  this);
    
    NSString * ownerProfileId = @"1234-1234-1234-1234";
    NSString * matchId = @"1234-1234-1234-1234";
    uint64_t matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    NSString * matchSummaryJson; // { "teamPoints" : 22 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc asyncMatchService]
            updateMatchSummaryData:ownerProfileId
                           matchId:matchId
                           version:matchVersion
                       jsonSummary:matchSummaryJson
                   completionBlock:successBlock
              errorCompletionBlock:failureBlock
                          cbObject:nil];
    
    var ownerProfileId = "1234-1234-1234-1234";
    var matchId = "1234-1234-1234-1234";
    var matchVersion; //Retreived from previous calls to AsyncMatch or by calling ReadMatch
    var matchSummaryJson = { "teamPoints" : 22 }
    function callback; //define callback
    
    brainCloudClient.asyncMatch.updateMatchSummaryData(ownerProfileId, matchId, matchVersion, matchSummaryJson, callback);
    
    string ownerId = "1234-1234-1234-1234";
    string matchId = "1234-1234-1234-1234";
    var version = 21;
    var summary = { "something" : 1234 };
    
    var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
    var retVal = asyncMatchProxy.updateMatchSummaryData(ownerId, matchId, version, summary);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "gameId": "145677",
            "ownerId": "2bd723c6-c2ec-4946-a1a8-02b7a38540ad",
            "matchId": "1aac24b2-7976-4fd7-b7c6-44d7ae6d26a4",
            "version": 2,
            "players": [
                {
                    "playerId": "2bd723c6-c2ec-4946-a1a8-02b7a38540ad",
                    "playerName": "UserA",
                    "pictureUrl": null
                },
                {
                    "playerId": "11c2dd4d-9ed1-416d-bd04-5228c1efafac",
                    "playerName": "UserB",
                    "pictureUrl": null
                }
            ],
            "status": {
                "status": "PENDING",
                "currentPlayer": "11c2dd4d-9ed1-416d-bd04-5228c1efafac"
            },
            "summary": {
                "resources": 2564
            },
            "createdAt": 1442507219609,
            "updatedAt": 1442507550372
        }
    }
    

    Allows the current player (only) to update Summary data without having to submit a whole turn.

    Service Operation
    "asyncMatch" "UPDATE_SUMMARY"
    Method Parameters
    Parameter Description
    ownerId Match owner identifier
    matchId Match identifier
    version Game state version to ensure turns are submitted once and in order
    jsonSummary JSON string provided by the caller that other players will see as a summary of the game when listing their games

    Chat

    Chat is a new service that enables real-time communication between end-users. It is available to apps that have brainCloud RTT enabled.

    Key concepts

    Chat message format { "chId": "<channel id>", "msgId": "<guid>", "date": 1530069895070, "ver": 1, "from": { "id": "<profileId>", "name": "<name>", "pic": "<pictureUrl>" }, "content": { "text": "simple message", "rich": {} } }

    Chat message fields

    Field Description
    chId The channel id
    msgId The chat message id (used for editing / deleting posted messages)
    date The time the message was posted (in utc millis)
    ver The version of the message
    from Information about who the chat message is from. Includes name and picture url if available
    content The content of the chat message. Contents are up to the developer - but for visibility in tools, should have a text field for plain-text message content

    Channel Types

    brainCloud currently supports two types of channels:

    Channel Type Membership Creation Description
    global All users of the app Via portal All users of an app can access global channels. By default, an app can have up to 10 channels. Contact us with your use case for more.
    group All members of a Group Auto A channel is automatically created for each group in the system. Any group member can access it.

    Pro-tip - if you are interested in one-to-one chat, see our Messaging api...

    API calls

    The following client API calls are available.

    Channel lookup and management
    Retrieving chat messages
    Posting chat messages
    Updating chat messages
    System chat API (cloud-code only)

    These API calls bypass channel membership / message ownership checks - and allow you to post messages from the system (i.e. app) instead of from another end-user:

    ChannelConnect

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:   Register a chat callback
    RTTCallback rttCallback = response =>
    {
       Debug.Log(response);
    };
    _bc.RegisterRTTChatCallback(rttCallback);
    
    //Step 3:   Now, you can call ChannelConnect
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    int maxReturn = 25;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
        var messages = (Dictionary<string, object>[]) jsonData["messages"];
    
        foreach (Dictionary<string, object> message in messages)
        {
            var content = (Dictionary<string, object>)message["content"];
            var item = (Dictionary<string, object>)content["SELL_ITEM"];
    
            string itemType = item["ITEM_TYPE"].ToString();
            string itemId = item["ITEM_ID"].ToString();
            string price = item["PRICE"].ToString();
            string currency = item["CURRENCY"].ToString();
            string logMessage = string.Join(" | ", new[] {itemType, itemId, price, currency});
            Debug.Log(logMessage);  // COUCH | d05a5b9d-374e-41e2-a498-c7387bf15c76 | 105 | GOLDCOINS
        }
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[ChannelConnect Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.ChatService.ChannelConnect(channelId, maxReturn, successCallback, failureCallback);
    
    String channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    int maxReturn = 25;
    this; // implements IServerCallback
    
    _bc.getChatService().channelConnect(channelId, maxReturn, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_TRADE";
    var maxReturn = 25;
    
    _bc.chat.channelConnect(channelId, maxReturn, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var idResult = chatProxy.getChannelId( 'gl', 'bitChat' );
    if ( idResult.status == 200 ) {
    
        var channelId = idResult.data.channelId;
    
        connectResult = chatProxy.channelConnect(channelId, 25);
    } 
    
    Show Example JSON Return {}
    {
        "data": {
            "messages": [{
                "date": 1530649082684,
                "ver": 1,
                "msgId": "783692330334210",
                "from": {
                    "id": "a7b7de02-8432-4547-8c40-9af94537fce0",
                    "name": "RedBomber",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "Looking to sell a couch for 105 gold coins.",
                    "rich": {
                        "SELL_ITEM": {
                            "ITEM_TYPE": "COUCH",
                            "ITEM_ID": "d05a5b9d-374e-41e2-a498-c7387bf15c76",
                            "PRICE": "105",
                            "CURRENCY": "GOLDCOINS"
                        }
                    }
                }
            }, 
            {
                "date": 1530650080029,
                "ver": 1,
                "msgId": "783692840974851",
                "from": {
                    "id": "805cc012-0bf1-40a0-9716-b896d8f4c424",
                    "name": "Chantel",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "For that couch, how about 25 gems instead?"
                }
            }, 
            {
                "date": 1530650218944,
                "ver": 1,
                "msgId": "783692912099332",
                "from": {
                    "id": "a7b7de02-8432-4547-8c40-9af94537fce0",
                    "name": "RedBomber",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "Sold!"
                }
            }]
        },
        "status": 200
    }
    

    Registers a handler for incoming events from the specified channelId. Also returns a list of that channel's recent messages (from history).

    Service Operation
    "chat" "CHANNEL_CONNECT"
    Method Parameters
    Parameter Description
    channelId The id of the channel to connect to.
    maxReturn The maximum number of recent messages to return from history.
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature

    ChannelDisconnect

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:   Now, you can call ChannelDisconnect
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        var status = jsonMessage["status"].ToString();
    
        string logMessage = string.Join(" | ", new [] {status});
        Debug.Log(logMessage); // 200
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[ChannelDisconnect Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.ChatService.ChannelDisconnect(channelId, successCallback, failureCallback);
    
    String channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    this; // implements IServerCallback
    
    _bc.getChatService().channelDisconnect(channelId, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_TRADE";
    
    _bc.chat.channelDisconnect(channelId, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    chatProxy.channelDisconnect(channelId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {}
    }
    

    Disconnects from the specified channel, unregistering the handler.

    Service Operation
    "chat" "CHANNEL_DISCONNECT"
    Method Parameters
    Parameter Description
    channelId The id of the channel to connect to.
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature

    DeleteChatMessage

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Have a msgId from a chat message to delete
    //Step 3:   Now, you can call DeleteChatMessage
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    string msgId = "784130333859899";
    int version = -1;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        var jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
        string deleted = jsonData["deleted"].ToString();
    
        string logMessage = string.Join(" | ", new [] {deleted});
        Debug.Log(logMessage); // 1
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[DeleteChatMessage Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.ChatService.DeleteChatMessage(channelId, msgId, version, successCallback, failureCallback);
    
    String channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    String msgId = "784130333859899";
    int version = -1;
    this; // implements IServerCallback
    
    _bc.getChatService().deleteChatMessage(channelId, msgId, version, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_TRADE";
    var msgId = "784130333859899";
    var version = -1;
    
    _bc.chat.channelDisconnect(channelId, msgId, version, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var result = chatProxy.deleteChatMessage( channelId, msgId, ver );
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "deleted": 1
        }
    }
    

    Delete the specified chat message. Message must have been from this user. Version must match (or pass -1 to bypass version enforcement).

    Returns the number of messages that were deleted. Since the history rolls over, it is possible that the message had already expired before the delete attempt - in that case, the value of the deleted field will be 0.

    Service Operation
    "chat" "DELETE_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    version The version of the message. Pass it -1 to bypass version checking.
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature

    GetChannelId

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetChannelId
    
    string channelType = "gl";
    string channelSubId = "CHAT_TRADE";
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
    
        var channelId = jsonData["channelId"].ToString();
    
        string logMessage = string.Join(" | ", new [] {channelId});
        Debug.Log(logMessage); // 22817:gl:CHAT_TRADE
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[GetChannelId Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.GetChannelId(channelType, channelSubId, successCallback, failureCallback);
    
    String channelType = "gl";
    String channelSubId = "CHAT_TRADE";
    this; // implements IServerCallback
    
    _bc.getChatService().getChannelId(channelType, channelSubId, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelType = "gl";
    var channelSubId = "CHAT_TRADE";
    
    _bc.chat.getChannelId(channelType, channelSubId, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var idResult = proxy.getChannelId( 'gl', 'bcChat');
    if (idResult.status == 200 ) {
        channelId = idResult.data.channelId;
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "channelId": "22817:gl:CHAT_TRADE"
        }
    }
    

    Retrieves a channel id given the specified lookup parameters.

    Service Operation
    "chat" "GET_CHANNEL_ID"
    Method Parameters
    Parameter Description
    channelType The channel type - 'gl' for global, 'gr' for groups
    channelSubId The type-specific sub id
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The sub id for the channel type is not recognized

    GetChannelInfo

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetChannelInfo
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
        var name = jsonData["name"].ToString();
        var desc = jsonData["desc"].ToString();
    
        string logMessage = string.Join(" | ", new [] {name, desc});
        Debug.Log(logMessage); // Trade Chat | Trade items here.
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[GetChannelInfo Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.GetChannelInfo(channelId, successCallback, failureCallback);
    
    String channelType = "gl";
    String channelSubId = "CHAT_TRADE";
    this; // implements IServerCallback
    
    _bc.getChatService().getChannelInfo(channelType, channelSubId, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelType = "gl";
    var channelSubId = "CHAT_TRADE";
    
    _bc.chat.getChannelInfo(channelType, channelSubId, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var infoResult = chatProxy.getChannelInfo(channelId);
    
    Show Example JSON Return {}
    {
        "data": {
            "id": "22817:gl:CHAT_TRADE",
            "type": "gl",
            "code": "CHAT_TRADE",
            "name": "Trade Chat",
            "desc": "Trade items here.",
            "stats": {
                "messageCount": 25
            }
        },
        "status": 200
    }
    

    Returns description info and activity stats for the specified channel. Note that numMembers, numListeners and listeners are only returned for non-global groups. Only callable by members of the channel.

    Service Operation
    "chat" "GET_CHANNEL_INFO"
    Method Parameters
    Parameter Description
    channelId The id of the channel
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature

    GetChatMessage

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetChatMessage
    
    string channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    string msgId = "783820066133040";
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
    
        var date = jsonData["date"].ToString();
        var name = ((Dictionary<string, object>)jsonData["from"])["name"].ToString();
        var text = ((Dictionary<string, object>)jsonData["content"])["text"].ToString();
        string logMessage = string.Join(" | ", new [] {date, name, text});
        Debug.Log(logMessage); // 1530898566666 | RedBomber | Anyone looking for a group?
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[GetChatMessage Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.GetChatMessage(channelId, msgId, successCallback, failureCallback);
    
    String channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    String msgId = "783820066133040";
    this; // implements IServerCallback
    
    _bc.getChatService().getChatMessage(channelId, msgId, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    var msgId = "783820066133040";
    
    _bc.chat.getChatMessage(channelId, msgId, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var getResult = chatProxy.getChatMessage(channelId, msgId);
    if (getReult.status == 200 ) {
        msgText = getResult.data.content.text;
    }
    
    Show Example JSON Return {}
    {
        "data": {
            "date": 1530898566666,
            "ver": 1,
            "msgId": "783820066133040",
            "from": {
                "id": "a7b7de02-8432-4547-8c40-9af94537fce0",
                "name": "RedBomber",
                "pic": null
            },
            "chId": "22817:gl:CHAT_TRADE",
            "content": {
                "text": "Anyone looking for a group?"
            }
        },
        "status": 200
    }
    

    Retrieves a chat message object from history. If the message cannot be found, that data section returned will be empty.

    Service Operation
    "chat" "GET_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid

    GetRecentChatMessages

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetRecentChatMessages
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    int maxReturn = 25;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
        var messages = (Dictionary<string, object>[]) jsonData["messages"];
    
        foreach (Dictionary<string, object> message in messages)
        {
            var content = (Dictionary<string, object>)message["content"];
            var item = (Dictionary<string, object>)content["SELL_ITEM"];
    
            string itemType = item["ITEM_TYPE"].ToString();
            string itemId = item["ITEM_ID"].ToString();
            string price = item["PRICE"].ToString();
            string currency = item["CURRENCY"].ToString();
            string logMessage = string.Join(" | ", new[] {itemType, itemId, price, currency});
            Debug.Log(logMessage);  // COUCH | d05a5b9d-374e-41e2-a498-c7387bf15c76 | 105 | GOLDCOINS
        }
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[GetRecentChatMessages Failed] {0}  {1}  {2}", status, code, error));
    };
    
    _bc.ChatService.GetRecentChatMessages(channelId, maxReturn, successCallback, failureCallback);
    
    String channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    int maxReturn = 25;
    this; // implements IServerCallback
    
    _bc.getChatService().getRecentChatMessages(channelId, maxReturn, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    var maxReturn = 25;
    
    _bc.chat.getRecentChatMessages(channelId, maxReturn, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var getResult = chatProxy.getRecentChatMessages( channelId, 25 );
    if (getResult.status == 200 ) {
        msgArray = getResult.data.messages;
    }
    
    Show Example JSON Return {}
    {
        "data": {
            "messages": [{
                "date": 1530649082684,
                "ver": 1,
                "msgId": "783692330334210",
                "from": {
                    "id": "a7b7de02-8432-4547-8c40-9af94537fce0",
                    "name": "RedBomber",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "Looking to sell a couch for 105 gold coins.",
                    "rich": {
                        "SELL_ITEM": {
                            "ITEM_TYPE": "COUCH",
                            "ITEM_ID": "d05a5b9d-374e-41e2-a498-c7387bf15c76",
                            "PRICE": "105",
                            "CURRENCY": "GOLDCOINS"
                        }
                    }
                }
            }, 
            {
                "date": 1530650080029,
                "ver": 1,
                "msgId": "783692840974851",
                "from": {
                    "id": "805cc012-0bf1-40a0-9716-b896d8f4c424",
                    "name": "Chantel",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "For that couch, how about 25 gems instead?"
                }
            }, 
            {
                "date": 1530650218944,
                "ver": 1,
                "msgId": "783692912099332",
                "from": {
                    "id": "a7b7de02-8432-4547-8c40-9af94537fce0",
                    "name": "RedBomber",
                    "pic": null
                },
                "chId": "22817:gl:CHAT_TRADE",
                "content": {
                    "text": "Sold!"
                }
            }]
        },
        "status": 200
    }
    

    Returns a list of max messages from history.

    Service Operation
    "chat" "GET_RECENT_MESSAGES"
    Method Parameters
    Parameter Description
    channelId The chat channel to retrieve messages from
    maxReturn Maximum number of messages to return
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid

    GetSubscribedChannels

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call GetSubscribedChannels
    
    string channelType = "all";
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
        var channels = (Dictionary<string, object>[]) jsonData["channels"];
    
        foreach (Dictionary<string, object> channel in channels)
        {
            string id = channel["id"].ToString();
            string desc = channel["desc"].ToString();
            string messageCount = ((Dictionary<string, object>)channel["stats"])["messageCount"].ToString();
            string logMessage = string.Join(" | ", new [] {id, desc, messageCount});
            Debug.Log(logMessage); // 22817:gl:CHAT_GLOBAL | General discussion about the app. | 25                 
        }
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[GetSubscribedChannels Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.GetSubscribedChannels(channelType, successCallback, failureCallback);
    
    String channelType = "all";
    this; // implements IServerCallback
    
    _bc.getChatService().getSubscribedChannels(channelType, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelType = "all";
    
    _bc.chat.getSubscribedChannels(channelType, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var subResult = chatProxy.getSubscribedChannels('');
    if ( subResult.status == 200 ) {
        var channelArray = subResult.data.channels;
    }
    
    Show Example JSON Return {}
    {
        "data": {
            "channels": [{
                "id": "22817:gl:CHAT_GLOBAL",
                "type": "gl",
                "code": "CHAT_GLOBAL",
                "name": "Global Chat",
                "desc": "General discussion about the app.",
                "stats": {
                    "messageCount": 25
                }
            }, 
            {
                "id": "22817:gl:CHAT_GROUPFINDER",
                "type": "gl",
                "code": "CHAT_GROUPFINDER",
                "name": "Group Finder",
                "desc": "Find a group.",
                "stats": {
                    "messageCount": 25
                }
            }, 
            {
                "id": "22817:gl:CHAT_TRADE",
                "type": "gl",
                "code": "CHAT_TRADE",
                "name": "Trade Chat",
                "desc": "Trade items here.",
                "stats": {
                    "messageCount": 25
                }
            }]
        },
        "status": 200
    }
    

    Returns a list of the channels of the specified type that the user has access to, with description info.

    Service Operation
    "chat" "GET_SUBSCRIBED_CHANNELS"
    Method Parameters
    Parameter Description
    channelType Specifies the type of channels subscriptions to return. If empty string, returns channels of all types.
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature

    PostChatMessage

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call PostChatMessage
    
    string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    string chatMessage = "Looking to sell a couch for 105 gold coins.";
    Dictionary<string, object> sellItem = new Dictionary<string, object>
    {
        { "ITEM_TYPE", "COUCH" },
        { "ITEM_ID", "d05a5b9d-374e-41e2-a498-c7387bf15c76" },
        { "PRICE", "105" },
        { "CURRENCY", "GOLDCOINS" }
    };
    Dictionary<string, object> richContent = new Dictionary<string, object>
    {
        {"SELL_ITEM", sellItem }
    };
    var jsonRich = JsonFx.Json.JsonWriter.Serialize(richContent);
    bool recordInHistory = true;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
    
        var msgId = jsonData["msgId"].ToString();
        string logMessage = string.Join(" | ", new [] {msgId});
        Debug.Log(logMessage); // 783733181125648
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[PostChatMessage Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.PostChatMessage(channelId, chatMessage, jsonRich, true, successCallback,
        failureCallback);
    
    String channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    String chatMessage = "Looking to sell a couch for 105 gold coins.";
    String jsonRich = "";
    this; // implements IServerCallback
    
    _bc.getChatService().postChatMessage(channelId, chatMessage, jsonRich, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    var content = {text: "Looking to sell a couch for 105 gold coins.", SELL_ITEM: {ITEM_TYPE: "COUCH"}};
    
    _bc.chat.postChatMessage(channelId, content, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    var content = {};
    content.text = "Hellooooo!";
    
    var postResult = chatProxy.postChatMessage( channelId, content, true );
    if (postResult.status == 200 ) {
        // Success!
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "msgId": "783347769003570"
        }
    }
    

    Sends a potentially richer member chat message. By convention, content should contain a field named text for plain-text content. Returns the id of the message created.

    Service Operation
    "chat" "POST_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The chat channel to post to
    contentJson The json content of the message
    recordInHistory Set to false if the message shouldn't be recorded to history. Useful for sending non-conversational messages, like when users join a room, etc.
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid

    PostChatMessageSimple

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call PostChatMessageSimple
    
    string channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    string chatMessage = "Hey, I am looking for new and experienced users to join our group.";
    bool recordInHistory = true;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
    
        var msgId = jsonData["msgId"].ToString();
        string logMessage = string.Join(" | ", new [] {msgId});
        Debug.Log(logMessage); // 783733181125648
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[PostChatMessageSimple Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.PostChatMessageSimple(channelId, chatMessage, true, successCallback,
        failureCallback);
    
    String channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    String chatMessage = "Hey, I am looking for new and experienced users to join our group.";
    this; // implements IServerCallback
    
    _bc.getChatService().postChatMessageSimple(channelId, this);
    
    public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
    {
        System.out.print(String.format("Success | %s", jsonData.toString()));
    }
    public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
    {
        System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
    }
    
    Coming soon!
    
    var channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    var chatMessage = "Hey, I am looking for new and experienced users to join our group.";
    var jsonRich = "";
    
    _bc.chat.postChatMessageSimple(channelId, chatMessage, result =>
    {
        var status = result.status;
        console.log(status + " : " + JSON.stringify(result, null, 2));
    });
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var postResult = chatProxy.postChatMessageSimple( channelId, "Helloooo!!!", true );
    if (postResult.status == 200 ) {
        // Success!
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "msgId": "783822917533185"
        }
    }
    

    Sends a text-only member chat message on behalf of the user. This method provides convenience by simplifying message construction. Returns the id of the message that was created.

    Service Operation
    "chat" "POST_CHAT_MESSAGE_SIMPLE"
    Method Parameters
    Parameter Description
    channelId The chat channel to post to
    contentString Simple string content for the message. Will be placed inside of a text field of the content section.
    recordInHistory Set to false if the message shouldn't be recorded to history. Useful for sending non-conversational messages, like when users join a room, etc.
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid

    SysDeleteChatMessage

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    var result = chatProxy.deleteSysChatMessage( channelId, msgId, ver );
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "deleted": 1
        }
    }
    

    Delete the specified chat message. Message can be from any user (or the system). Version must match (or pass -1 to bypass version enforcement).

    Returns the number of messages that were deleted. Since the history rolls over, it is possible that the message had already expired before the deletion attempt - in that case, the value of the deleted field will be 0.

    Service Operation
    "chat" "DELETE_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    version The version of the message. Pass it -1 to bypass version checking.
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysGetChannelInfo

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    var infoResult = chatProxy.sysGetChannelInfo(channelId);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "id": "55555:gl:brainCloudDev",
            "type": "gl",
            "code": "brainCloudDev",
            "name": "brainCloud dev",
            "desc": "For discussing brainCloud development status",
            "stats": {
                "messageCount": 25
            }
        }
    }
    

    Returns description info and activity stats for the specified channel. Note that numMembers, numListeners and listeners are only returned for non-global groups.

    Service Operation
    "chat" "GET_CHANNEL_INFO"
    Method Parameters
    Parameter Description
    channelId The id of the channel
    Error returns
    Code Name Description
    40346 CHAT_INVALID_CHANNEL_ID The channel id provided is invalid.
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysGetChatMessage

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    var getResult = chatProxy.sysGetChatMessage(channelId, msgId);
    if (getReult.status == 200 ) {
        msgText = getResult.data.content.text;
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "date": 1529978814276,
            "ver": 1,
            "msgId": "783349152909363",
            "from": {
                "id": "004a7d0c-4e96-474b-972b-7794e0eec8d5",
                "name": "",
                "pic": null
            },
            "chId": "22682:gl:brainCloudDev",
            "content": {
                "text": "Hello world",
                "rich": {
                    "somethingCustom": "wow"
                }
            }
        }
    }
    

    Retrieves a chat message object from history. If the message cannot be found, that data section returned will be empty.

    Service Operation
    "chat" "GET_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysGetRecentChatMessages

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    var getResult = chatProxy.sysGetRecentChatMessages( channelId, 25 );
    if (getResult.status == 200 ) {
        msgArray = getResult.data.messages;
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "messages": [
                {
                    "date": 1529947494687,
                    "ver": 1,
                    "msgId": "783333117279792",
                    "from": {
                        "id": "f0bdf734-f5ed-4617-8f40-62795dc82932",
                        "name": "Paul Winterhalder",
                        "pic": null
                    },
                    "chId": "55555:gl:brainCloudDev",
                    "content": {
                        "text": "This is a test"
                    }
                },
                {
                    "date": 1529948166604,
                    "ver": 1,
                    "msgId": "783333461301297",
                    "from": {
                        "id": "3b87aaa8-b47a-4096-9809-ce0da77ae60d",
                        "name": "",
                        "pic": null
                    },
                    "chId": "55555:gl:brainCloudDev",
                    "content": {
                        "text": "Hello world"
                    }
                }
            ]
        }
    }
    

    Returns a list of max messages from history.

    Service Operation
    "chat" "GET_RECENT_MESSAGES"
    Method Parameters
    Parameter Description
    channelId The chat channel to retrieve messages from
    maxReturn Maximum number of messages to return
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysPostChatMessage

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var content = {};
    content.text = "Hellooooo!";
    
    var from = {};
    from.name = "The Overseer";
    from.pic = "https://myprofilepic.com?id=555"
    
    var postResult = chatProxy.sysPostChatMessage( channelId, content, true, from );
    if (postResult.status == 200 ) {
        // Success!
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "msgId": "783347769003570"
        }
    }
    

    Sends a potentially richer member chat message. By convention, content should contain a field named text for plain-text content. From is a json containing the message originator info - in this case normally "name" and potentially a "pic" url. Returns the id of the message created.

    Service Operation
    "chat" "POST_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The chat channel to post to
    contentJson The json content of the message
    recordInHistory Set to false if the message shouldn't be recorded to history. Useful for sending non-conversational messages, like when users join a room, etc.
    fromJson the from information for message. Should not include id.
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysPostChatMessageSimple

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var text = "Hellooooo!";
    
    var from = {};
    from.name = "The Overseer";
    from.pic = "https://myprofilepic.com?id=555"
    
    var postResult = chatProxy.sysPostChatMessageSimple( channelId, text, true, from );
    if (postResult.status == 200 ) {
        // Success!
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "msgId": "783347769003570"
        }
    }
    

    Sends a simple-text member chat message. From is a json containing the message originator info - in this case normally "name" and potentially a "pic" url. Returns the id of the message created.

    Service Operation
    "chat" "POST_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The chat channel to post to
    text Text change message sent
    recordInHistory Set to false if the message shouldn't be recorded to history. Useful for sending non-conversational messages, like when users join a room, etc.
    fromJson the from information for message. Should not include id.
    Error returns
    Code Name Description
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    SysUpdateChatMessage

    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    // Switch to CC tab
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var newContent = {};
    newContent.text = "This is updated message text";
    
    var updateResult = chatProxy.sysUpdateChatMessage( channelId, oldMsg.id, oldMsg.ver, newContent );
    if (updateResult.status == 200) {
        // Success!
    
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {}
    }
    

    Update the specified chat message. Message can have been from any user (or system). Version provided must match (or pass -1 to bypass version enforcement).

    Service Operation
    "chat" "UPDATE_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    version The version of the message. Pass it -1 to bypass version checking.
    contentJson Replacement content for the message
    Error returns
    Code Name Description
    40346 INSUFFICIDENT_PERMISSIONS The channel id provided is invalid.
    40595 CHAT_MESSASAGE_NOT_FOUND The specified message cannot be found
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid
    40616 CLOUD_CODE_ONLY Method only available via cloud code

    UpdateChatMessage

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call UpdateChatMessage
    
    string channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
    string messageId = "783822917533185";
    int version = -1;
    string chatMessage = "Hey, I am looking for experienced users to join our group.";
    string rich = "";
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Debug.Log(string.Format("[UpdateChatMessage Success] {0}", response));
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[UpdateChatMessage Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.ChatService.UpdateChatMessage(channelId, chatMessage, version, chatMessage, rich, successCallback, failureCallback);
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    var chatProxy = bridge.getChatServiceProxy();
    
    var newContent = {};
    newContent.text = "This is updated message text";
    
    var updateResult = chatProxy.updateChatMessage( channelId, oldMsg.id, oldMsg.ver, newContent );
    if (updateResult.status == 200) {
        // Success!
    
    }
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {}
    }
    

    Update the specified chat message. Message must have been from this user. Version provided must match (or pass -1 to bypass version enforcement).

    Service Operation
    "chat" "UPDATE_CHAT_MESSAGE"
    Method Parameters
    Parameter Description
    channelId The channel of the message
    msgId The message id
    version The version of the message. Pass it -1 to bypass version checking.
    contentJson Replacement content for the message
    Error returns
    Code Name Description
    40346 INSUFFICIDENT_PERMISSIONS The channel id provided is invalid.
    40595 CHAT_MESSASAGE_NOT_FOUND The specified message cannot be found
    40601 RTT_NOT_ENABLED RTT must be enabled for this feature
    40603 CHAT_UNRECOGNIZED_CHANNEL The specified channel is invalid

    Client

    The BrainCloudClient class is the core of the brainCloud API. From the BrainCloudClient you can access all of brainCloud's services (Authentication, Entity, etc) and from there the individual API's they contain.

    The Client also contains many setup and configuration methods for timeouts, global callbacks, and more.

    Summary

    Critical

    Functions that are necessary to use the brianCloud library.

    Callbacks

    Functions to register and deregister callbacks for specific events.

    Timeouts

    Functions to configure network timeouts.

    Status

    Functions to query the client state or reset network communications.

    File Upload

    Functions to register for file upload callbacks and configure upload specific timeouts.

    Network Error Caching

    Functions to enable and manage network error message caching.

    Global Error Logging

    Functions to register and deregister callbacks for all error events.

    Realtime Tech (RTT)

    Functions to enable RTT, and register listener callbacks.

    Compatibility

    Compatibility settings for older brainCloud versions.

    DeregisterAllRTTCallbacks

    Coming soon!
    
    _bc.DeregisterAllRTTCallbacks();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Deregisters the RTT all callbacks.

    DeregisterEventCallback

    _bc.DeregisterEventCallback();
    
    _bc->deregisterEventCallback();
    
    [_bc deregisterEventCallback];
    
    _bc.deregisterEventCallback();
    
    brainCloudClient.deregisterEventCallback();
    

    Deregisters the event callback.

    DeregisterFileUploadCallback

    _bc.DeregisterFileUploadCallback();
    
    _bc->deregisterFileUploadCallback();
    
    [_bc deregisterFileUploadCallback];
    
    //Coming soon
    
    // N/A
    

    Deregisters the file upload callback

    DeregisterGlobalErrorCallback

    _bc.DeregisterGlobalErrorCallback();
    
    _bc->deregisterGlobalErrorCallback();
    
    [_bc deregisterGlobalErrorCallback];
    
    public void deregisterGlobalErrorCallback();
    
    // N/A
    

    Deregisters the global error callback.

    DeregisterNetworkErrorCallback

    _bc.DeregisterNetworkErrorCallback();
    
    _bc->deregisterNetworkErrorCallback();
    
    [_bc deregisterNetworkErrorCallback];
    
    public void deregisterNetworkErrorCallback();
    
    // N/A
    

    Deregisters the network error callback.

    DeregisterRewardCallback

    _bc.DeregisterRewardCallback();
    
    _bc->deregisterRewardCallback();
    
    [_bc deregisterRewardCallback];
    
    _bc.deregisterRewardCallback();
    
    brainCloudClient.deregisterRewardCallback();
    

    Deregisters the event callback.

    DeregisterRTTChatCallback

    Coming soon!
    
    _bc.DeregisterRTTChatCallback();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Deregisters the RTT Chat callback.

    DeregisterRTTEventCallback

    Coming soon!
    
    _bc.DeregisterRTTEventCallback();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Deregisters the RTT Event callback.

    DeregisterRTTLobbyCallback

    Coming soon!
    
    _bc.DeregisterRTTLobbyCallback();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Deregisters the RTT Lobby callback.

    DeregisterRTTMessagingCallback

    Coming soon!
    
    _bc.DeregisterRTTMessagingCallback();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Deregisters the RTT Messaging callback.

    DisableRTT

    Coming soon!
    
    _bc.DisableRTT();
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    

    Disables the RTT connection.

    Service Operation
    "rttRegistration" "disconnect"

    EnableLogging

    _bc.EnableLogging(true);
    
    _bc->enableLogging(true);
    
    [_bc enableLogging:true];
    
    _bc.enableLogging(true);
    
    brainCloudClient.enableLogging(true);
    

    Enables console logging of outgoing/incoming packets and other informational logs from the client.

    Parameter Description
    enabled True if logging should be enabled

    EnableNetworkErrorMessageCaching

    _bc.EnableNetworkErrorMessageCaching(true);
    
    _bc->enableNetworkErrorMessageCaching(true);
    
    [_bc enableNetworkErrorMessageCaching:true];
    
    _bc.enableNetworkErrorMessageCaching(true);
    
    // N/A
    

    Enables the timeout message caching which is disabled by default. Once enabled, if a client side timeout is encountered (i.e. brainCloud server is unreachable presumably due to the client network being down) the SDK will do the following:

    1. cache the currently queued messages to brainCloud
    2. call the network error callback
    3. then expect the app to call either:
      • RetryCachedMessages() to retry sending to brainCloud
      • FlushCachedMessages() to dump all messages in the queue.

    Between steps 2 & 3, the app can prompt the user to retry connecting to brainCloud to determine whether to follow path 3a or 3b.

    Note that if path 3a is followed, and another timeout is encountered, the process will begin all over again from step 1.

    Parameter Description
    enabled True if message should be cached on timeout

    EnableRTT

    Coming soon!
    
    //Step 1:   Initialize the brainCloud Wrapper and Authenticate the user 
    //          http://getbraincloud.com/apidocs/apiref/#wrapper
    //Step 2:   Now, you can call EnableRTT
    
    // Real-time Tech (RTT) must be checked on the dashboard, under Design | Core App Info | Advanced Settings.
    eRTTConnectionType rttConnectionType = eRTTConnectionType.WEBSOCKET;
    SuccessCallback successCallback = (response, cbObject) =>
    {
        Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
        Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
    
        string heartbeatSeconds = jsonData["heartbeatSeconds"].ToString();
    
        string logMessage = string.Join(" | ", new [] {heartbeatSeconds});
        Debug.Log(logMessage); // 30
    };
    FailureCallback failureCallback = (status, code, error, cbObject) =>
    {
        Debug.Log(string.Format("[EnableRTT Failed] {0}  {1}  {2}", status, code, error));
    };
    _bc.EnableRTT(rttConnectionType, successCallback, failureCallback);     
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    
    Show Example JSON Return {}
    {
        "service": "rtt",
        "operation": "CONNECT",
        "data": {
            "heartbeatSeconds": 30
        }
    }
    

    Attempts to establish an RTT connection to the brainCloud servers.

    RTT must be enabled in the Design Portal, under Design | Core App Info | Advanced Settings.

    RTT is available to Business Plan and above level subscriptions.

    Service Operation
    "rttRegistration" "REQUEST_CLIENT_CONNECTION"
    Method Parameters
    Parameter Description
    connectionType Type of RTT connections being established. Examples: WebSocket, TCP.

    FlushCachedMessages

    _bc.FlushCachedMessages(false);
    
    _bc->flushCachedMessages(true);
    
    [_bc flushCachedMessages:true];
    
    _bc.flushCachedMessages(true);
    
    // N/A
    

    Flushes the cached messages to resume API call processing. This will dump all of the cached messages in the queue.

    Parameter Description
    sendApiErrorCallbacks If set to true API error callbacks will be called for every cached message with statusCode CLIENT_NETWORK_ERROR and reasonCode CLIENT_NETWORK_ERROR_TIMEOUT.

    GetAuthenticationPacketTimeout

    int timeout = _bc.GetAuthenticationPacketTimeout();
    
    int timeout = _bc->getAuthenticationPacketTimeout();
    
    int timeout = [_bc getAuthenticationPacketTimeout];
    
    int timeout = _bc.getAuthenticationPacketTimeout();
    
    // N/A
    

    Gets the authentication packet timeout which is tracked separately from all other packets. Note that authentication packets are never retried and so this value represents the total time a client would wait to receive a reply to an authentication API call.

    By default this timeout is set to 15 seconds.

    GetInstance

    //C# uses a property instead of GetInstance
    BrainCloudClient client = BrainCloudClient.Instance;
    
    brainCloudClient* client = BrainCloudClient::getInstance();
    
    brainCloudClient* client = [BrainCloudClient getInstance];
    
    BrainCloudClient client = BrainCloudClient::getInstance();
    
    // N/A
    

    Returns the BrainCloudClient instance.

    GetPacketTimeouts

    List<int> timeouts = _bc.GetPacketTimeouts();
    
    std::vector<int> timeouts = _bc->getPacketTimeouts();
    
    NSArray* timeouts = [_bc getPacketTimeouts];
    
    ArrayList<Integer> timeouts = _bc.getPacketTimeouts();
    
    // N/A
    

    Returns the list of packet timeouts.

    GetSessionId

    string sessionId = _bc.GetSessionId();
    
    const char * sessionId = _bc->getSessionId();
    
    const char * sessionId = [_bc sessionId];
    
    String sessionId = _bc.getSessionId();
    
    var sessionId = brainCloudClient.getSessionId();
    

    Returns the session id if a connection with brainCloud has been established.

    GetUploadLowTransferRateThreshold

    int bytesPerSecThreshold = _bc.GetUploadLowTransferRateThreshold();
    
    int bytesPerSecThreshold = _bc->getUploadLowTransferRateThreshold();
    
    int bytesPerSecThreshold = [_bc getUploadLowTransferRateThreshold];
    
    // N/A
    
    // N/A
    

    Returns the low transfer rate threshold in bytes/sec.

    GetUploadLowTransferRateTimeout

    int timeout = _bc.GetUploadLowTransferRateTimeout();
    
    int timeout = _bc->getUploadLowTransferRateTimeout();
    
    int timeout = [_bc getUploadLowTransferRateTimeout];
    
    // N/A
    
    // N/A
    

    Returns the low transfer rate timeout in seconds.

    Initialize

    To initialize, use this code:

    const char* serverUrl = "https://sharedprod.braincloudservers.com/dispatcherv2";
    const char* secret = "1234-1234-1234-1234";
    const char* appId = "123456";
    
    _bc->initialize(serverUrl, secret, appId, "1.0.0");
    
    // If you're using Unity, you can make use of the brainCloudSettings toolbar
    string serverUrl = "https://sharedprod.braincloudservers.com/dispatcherv2";
    string secret = "1234-1234-1234-1234";
    string appId = "123456";
    
    _bc.Initialize(serverUrl, secret, appId, "1.0.0");
    
    String serverUrl = "https://sharedprod.braincloudservers.com/dispatcherv2";
    String secret = "1234-1234-1234-1234";
    String appId = "123456";
    
    _bc.initialize(appId, secret, "1.0.0", serverUrl);
    
    NSString* serverUrl = @"https://sharedprod.braincloudservers.com/dispatcherv2";
    NSString* secret = @"1234-1234-1234-1234";
    NSString* appId = @"123456";
    
    [_bc initialize:serverUrl
                                     secretKey:secret
                                        appId:appId
                                        appVersion:"1.0.0"];
    
    var secret = "1234-1234-1234-1234";
    var appId = "123456";
    
    brainCloudClient.initialize(appId, secret, "1.0.0");
    

    This method initializes the brainCloud client SDK. The information required to initialize can be found on the Application IDs page of the portal.

    Method Parameters
    Parameter Description
    serverUrl The url of the brainCloud server.
    secretKey The secret key for your app found in the brainCloud portal.
    appId The id of your app found in the brainCloud portal.
    appVersion The version of your app. This can be used to prevent older versions of your app from logging into brainCloud

    InitializeIdentity

    _bc->initializeIdentity("myProfileId", "myAnonymousId");
    
    _bc.InitializeIdentity("myProfileId", "myAnonymousId");
    
    _bc.initializeIdentity("myProfileId", "myAnonymousId");
    
    [_bc initializeIdentity:@"myProfileId", anonymousId:@"myAnonymousId"];
    
    brainCloudClient.initializeIdentity = function(profileId, anonymousId)
    

    Initializes the authentication service with an anonymous installation ID and most recently used profile ID. You will need to call this method before authenticating anonymously.

    Note that calling this is the same as calling Initialize in the BrainCloudAuthentication service.

    Method Parameters
    Parameter Description
    profileId The profile id of the user
    anonymousId The anonymous id of the user

    InsertEndOfMessageBundleMarker

    _bc->insertEndOfMessageBundleMarker();
    
    _bc.InsertEndOfMessageBundleMarker();
    
    _bc.insertEndOfMessageBundleMarker();
    
    [_bc insertEndOfMessageBundleMarker];
    
    brainCloudClient.insertEndOfMessageBundleMarker();
    

    Inserts a marker which will tell the brainCloud comms layer to close the message bundle off at this point. Any messages queued before this method was called will likely be bundled together in the next send to the server.

    IsAuthenticated

    bool isAuthenticated = _bc->isInitialized();
    
    bool isAuthenticated = _bc.Authenticated;
    
    boolean isAuthenticated = _bc.isAuthenticated();
    
    bool isAuthenticated = [_bc isAuthenticated];
    
    var isAuthenticated = brainCloudClient.isAuthenticated();
    

    Returns true if the user is currently authenticated. If a session time out or session invalidation is returned from executing a sever API call, this flag will reset back to false.

    IsInitialized

    bool isInitialized = _bc->isInitialized();
    
    bool isInitialized = _bc.Initialized;
    
    boolean isInitialized = _bc.isInitialized();
    
    bool isInitialized = [_bc isInitialized];
    
    var isInitialized = brainCloudClient.isInitialized();
    

    Returns whether the BrainCloudClient has been initialized using the Initialize() method.

    OverrideCountryCode

    const char* countryCode = "CA";
    _bc->overrideCountryCode(countryCode);
    
    string countryCode = "CA";
    _bc.OverrideCountryCode(countryCode);
    
    String countryCode = "CA";
    _bc.overrideCountryCode(countryCode);
    
    NSString* countryCode = @"CA";
    [_bc overrideCountryCode:countryCode];
    
    var countryCode = "CA";
    brainCloudClient.overrideCountryCode(countryCode);
    

    Sets the country code sent to brainCloud when a user authenticates. Will override any auto detected country.

    These methods should be called before authenticating so that they are sent to the server.

    Parameter Description
    countryCode ISO 3166-1 two-letter country code

    OverrideLanguageCode

    const char* languageCode = "en";
    _bc->overrideLanguageCode(languageCode);
    
    string languageCode = "en";
    _bc.OverrideLanguageCode(languageCode);
    
    String languageCode = "en";
    _bc.overrideLanguageCode(languageCode);
    
    NSString* languageCode = @"en";
    [_bc overrideLanguageCode:languageCode];
    
    var languageCode = "en";
    brainCloudClient.overrideLanguageCode(languageCode);
    

    Sets the language code sent to brainCloud when a user authenticates. If the language is set to a non-ISO 639-1 standard value the app default will be used instead. The supported languages and the default can be set on the Localization page of the portal.

    These methods should be called before authenticating so that they are sent to the server.

    Will override any auto detected language.

    Parameter Description
    languageCode ISO 639-1 two-letter language code

    RegisterEventCallback

    _bc.RegisterEventCallback(callbackFunction);
    
    _bc->registerEventCallback(this);
    
    eventBlock = ^(NSString *eventsJson) {  };
    
    [_bc registerEventCallback:eventBlock];
    
    _bc.registerEventCallback(callback);
    
    brainCloudClient.registerEventCallback(eventCallback);
    
    Show Example JSON Return {}
    {
        "events": [
            {
                "fromPlayerId": "178ed06a-d575-4591-8970-e23a5d35f9df",
                "eventId": 3967,
                "createdAt": 1441742105908,
                "gameId": "123",
                "toPlayerId": "178ed06a-d575-4591-8970-e23a5d35f9df",
                "eventType": "test",
                "eventData": {
                    "testData": 117
                }
            }
        ]
    }
    

    Sets a callback handler for any out of band event messages that come from brainCloud.

    Parameter Description
    eventCallback A function which takes a JSON string as it's only parameter.

    RegisterFileUploadCallback

    _bc.RegisterFileUploadCallbacks(successCallback, failureCallback);
    
    _bc->registerFileUploadCallback(this);
    
    fileUploadCompletedBlock = ^(NSString *fileUploadId, NSString *jsonResponse) { };
    
    fileUploadFailedBlock = ^(NSString *fileUploadId, NSInteger status, NSInteger reasonCode, NSString *jsonResponse) { };
    
    [_bc registerFileUploadCallback:fileUploadCompletedBlock failedBlock:fileUploadFailedBlock];
    
    _bc.registerFileUploadCallback(callback);
    
    // N/A
    
    Show Example JSON Return {}
    // SUCCESS JSON
    {
        "status": 200,
        "data": {
            "fileDetails": {
                "updatedAt": 1452616408147,
                "fileSize": 100,
                "fileType": "User",
                "expiresAt": 1452702808146,
                "shareable": true,
                "uploadId": "cf9a075c-587e-4bd1-af0b-eab1a79b958f",
                "createdAt": 1452616408147,
                "profileId": "bf8a1433-62d2-448e-b396-f3dbffff44",
                "gameId": "99999",
                "path": "dir1/dir2",
                "filename": "filename",
                "replaceIfExists": true,
                "cloudPath": "bc/g/99999/u/bf8a1433-62d2-448e-b396-f3dbffff44/f/dir1/dir2/filename"
            }
        }
    }
    
    // FAILURE JSON
    {
        "status": 403,
        "reason_code": 40300,
        "status_message": "Message describing failure",
        "severity": "ERROR"
    }
    

    Registers the file upload callbacks.

    Parameter Description
    fileUploadCallback The file upload callback handler.

    RegisterGlobalErrorCallback

    _bc.RegisterGlobalErrorCallbacks(failureCallback);
    
    _bc->registerGlobalErrorCallback(this);
    
    errorCompletionBlock  = ^(NSString *serviceName, NSString *serviceOperation, NSInteger statusCode, NSInteger reasonCode, NSString *jsonError, BCCallbackObject cbObject) { };
    
    [_bc registerGlobalErrorCallback:errorCompletionBlock];
    
    _bc.registerGlobalErrorCallback(callback);
    
    brainCloudClient.setErrorCallback(errorCallback);
    
    Show Example JSON Return {}
    // FAILURE JSON
    {
        "status": 403,
        "reason_code": 40300,
        "status_message": "Message describing failure",
        "severity": "ERROR"
    }
    

    Registers the Global Error callbacks.

    Useful for tracking and logging all errors.

    Parameter Description
    failureCallback The error callback handler.

    RegisterNetworkErrorCallback

    _bc.RegisterNetworkErrorCallback(callback);
    
    _bc->registerNetworkErrorCallback(this);
    
    networkErrorBlock = ^() {  };
    
    [_bc registerNetworkErrorCallback:networkErrorBlock];
    
    _bc.registerNetworkErrorCallback(callback);
    
    // N/A
    

    Registers a callback that is invoked for network errors. Note this is only called if EnableNetworkErrorMessageCaching has been set to true.

    Parameter Description
    callback The callback handler.

    RegisterRewardCallback

    _bc.RegisterRewardCallback(callbackFunction);
    
    _bc->registerRewardCallback(this);
    
    rewardBlock = ^(NSString *rewardsJson) {  };
    
    [_bc registerRewardCallback:rewardBlock];
    
    _bc.registerRewardCallback(callback);
    
    brainCloudClient.registerRewardCallback(rewardCallback);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "apiRewards": [{
            "service": "authenticationV2",
            "operation": "AUTHENTICATE",
            "rewards": {
                "rewardDetails": {
                    // the reward depending on type (see docs)
                }
            }
        }]
    }
    

    Sets a reward handler for any API call results that return rewards.

    Parameter Description
    rewardCallback The reward callback handler.

    RegisterRTTChatCallback

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:   Connect the user to a chat channel
    //          http://getbraincloud.com/apidocs/apiref/#capi-chat-channelconnect
    //Step 3:   Now, you can call RegisterRTTChatCallback
    
    RTTCallback rttCallback = response =>
    {
       Debug.Log(response);
    };
    _bc.RegisterRTTChatCallback(rttCallback);
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    
    Show Example JSON Return {}
    
    

    Registers a callback for RTT Chat Channel updates.

    Method Parameters
    Parameter Description
    rttCallback The RTT Chat callback handler.

    RegisterRTTEventCallback

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:   Now, you can call RegisterRTTEventCallback
    
    RTTCallback rttCallback = response =>
    {
       Debug.Log(response);
    };
    _bc.RegisterRTTEventCallback(rttCallback);
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    
    Show Example JSON Return {}
    
    

    Registers a real-time (RTT) callback for Events. Allows the standard SendEvent() call to push updates in real-time if the recipient is online.

    RTT Event Format { "service": "event", "operation": "GET_EVENTS", "data": { "evId": "5b44f50fe3adc1594bb09c94", "eventType": "testEvent", "fromPlayerId": "c3a455de-27f5-4126-a051-0effb1c75fd3", "toPlayerId": "44afc271-4e7a-430d-91cc-bca38c76acd0", "createdAt": 1531245839578, "eventData": { "customKey": "customValue" }, } }

    Method Parameters
    Parameter Description
    rttCallback The RTT Event callback handler.

    RegisterRTTLobbyCallback

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:  Connect the user to a lobby
    //         http://getbraincloud.com/apidocs/apiref/#capi-lobby-lobbyconnect
    //Step 3:   Now, you can call RegisterRTTLobbyCallback
    
    RTTCallback rttCallback = response =>
    {
       Debug.Log(response);
    };
    _bc.RegisterRTTLobbyCallback(rttCallback);
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    
    Show Example JSON Return {}
    
    

    Registers a callback for RTT Chat Channel updates.

    Method Parameters
    Parameter Description
    rttCallback The RTT Chat callback handler.

    RegisterRTTMessagingCallback

    Coming soon!
    
    //Step 1:   Start an RTT connection by calling EnableRTT
    //          http://getbraincloud.com/apidocs/apiref/#capi-client-enablertt
    //Step 2:   Now, you can call RegisterRTTMessagingCallback
    
    RTTCallback rttCallback = response =>
    {
       Debug.Log(response);
    };
    _bc.RegisterRTTMessagingCallback(rttCallback);
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    // N/A
    
    Show Example JSON Return {}
    
    

    Registers a callback for RTT Chat Channel updates.

    Method Parameters
    Parameter Description
    rttCallback The RTT Chat callback handler.

    ResetCommunication

    _bc.ResetCommunication();
    
    _bc->resetCommunication();
    
    [_bc resetCommunication];
    
    _bc.resetCommunication();
    
    brainCloudClient.resetCommunication();
    

    Clears any pending messages from communication library and clears all session information.

    RetryCachedMessages

    _bc.RetryCachedMessages();
    
    _bc->retryCachedMessages();
    
    [_bc retryCachedMessages];
    
    _bc.retryCachedMessages();
    
    // N/A
    

    Attempts to resend any cached messages. If no messages are in the cache, this method does nothing.

    RunCallbacks

    _bc.Update();
    
    _bc->runCallbacks();
    
    [_bc runCallbacks];
    
    _bc.runCallbacks();
    
    // N/A
    

    Run callbacks, to be called once per frame from your main thread

    SetErrorCallbackOn202Status

    // N/A
    
    _bc->setErrorCallbackOn202Status(true);
    
    [_bc setErrorCallbackOn202Status:true];
    
    // N/A
    
    // N/A
    

    Sets whether the error callback is triggered when a 202 status is received from the server. By default this is true.

    Parameter Description
    isError If set to true, 202 is treated as an error

    SetAuthenticationPacketTimeout

    int timeoutInSeconds = 30;
    _bc.SetAuthenticationPacketTimeout(timeoutInSeconds);
    
    int timeoutInSeconds = 30;
    _bc->setAuthenticationPacketTimeout(timeoutInSeconds);
    
    int timeoutInSeconds = 30;
    [_bc setAuthenticationPacketTimeout:timeoutInSeconds];
    
    int timeoutInSeconds = 30;
    _bc.setAuthenticationPacketTimeout(timeoutInSeconds);
    
    // N/A
    

    Sets the authentication packet timeout which is tracked separately from all other packets. Note that authentication packets are never retried and so this value represents the total time a client would wait to receive a reply to an authentication API call.

    By default this timeout is set to 15 seconds.

    Parameter Description
    timeoutSecs The timeout in seconds.

    SetOldStyleStatusMessageErrorCallback

    _bc.SetOldStyleStatusMessageErrorCallback(false);
    
    _bc->setOldStyleStatusMessageErrorCallback(false);
    
    [_bc setOldStyleStatusMessageErrorCallback:false];
    
    _bc.setOldStyleStatusMessageErrorCallback(false);
    
    // N/A
    

    Sets the error callback to return the status message instead of the error JSON string. This flag is used to conform to pre-2.17 client behavior.

    Parameter Description
    enabled If set to true, enable legacy error message format

    SetPacketTimeouts

    var packetTimeouts = new List<int> { 10, 10, 10 };
    _bc.SetPacketTimeouts(packetTimeouts);
    
    std::vector<int> packetTimeouts;
    packetTimeouts.push_back(10);
    packetTimeouts.push_back(10);
    packetTimeouts.push_back(10);
    
    _bc->setPacketTimeouts(packetTimeouts);
    
    NSArray* packetTimeouts = @[@10, @10, @10];
    [_bc setPacketTimeouts:packetTimeouts];
    
    ArrayList<Integer> packetTimeouts = new ArrayList<Integer>(
        Arrays.asList(10, 10, 10));
    _bc.setPacketTimeouts(packetTimeouts);
    
    // N/A
    

    Sets the packet timeouts using a list of integers that represent timeout values in seconds for each packet retry. The first item in the list represents the timeout for the first packet attempt, the second for the second packet attempt, and so on.

    The number of entries in this array determines how many packet retries will occur. By default, the packet timeout array is {10, 10, 10}

    Parameter Description
    intervalInSeconds The time between heartbeats in milliseconds

    SetPacketTimeoutsToDefault

    _bc.SetPacketTimeoutsToDefault();
    
    _bc->setPacketTimeoutsToDefault();
    
    [_bc setPacketTimeoutsToDefault];
    
    _bc.setPacketTimeoutsToDefault();
    
    // N/A
    

    Sets the packet timeouts back to default.

    SetUploadLowTransferRateThreshold

    int minTransferRate = 1500;
    _bc.SetUploadLowTransferRateThreshold(minTransferRate);
    
    int minTransferRate = 1500;
    _bc->setUploadLowTransferRateThreshold(minTransferRate);
    
    int minTransferRate = 1500;
    [_bc setUploadLowTransferRateThreshold:minTransferRate];
    
    // N/A
    
    // N/A
    

    Sets the low transfer rate threshold of an upload in bytes/sec.

    If the transfer rate dips below the given threshold longer than the specified timeout, the transfer will fail.

    By default this is set to 50 bytes/sec.

    Parameter Description
    bytesPerSec The low transfer rate threshold in bytes/sec

    SetUploadLowTransferRateTimeout

    int timeoutSecs = 60;
    _bc.SetUploadLowTransferRateTimeout(timeoutSecs);
    
    int timeoutSecs = 60;
    _bc->setUploadLowTransferRateTimeout(timeoutSecs);
    
    int timeoutSecs = 60;
    [_bc setUploadLowTransferRateTimeout:timeoutSecs];
    
    // N/A
    
    // N/A
    

    Sets the timeout in seconds of a low speed upload (ie transfer rate which is underneath the low transfer rate threshold).

    By default this is set to 120 seconds. Setting this value to 0 will turn off the timeout.

    Parameter Description
    timeoutSecs The timeout in seconds

    Update

    _bc.Update();
    
    // See RunCallbacks
    
    // See RunCallbacks
    
    // See RunCallbacks
    
    // N/A
    

    Update method needs to be called regularly in order to process incoming and outgoing messages.

    See RunCallbacks function for other platforms.

    Data Stream

    The data stream service allows you to send information about your users and their activity to brainCloud.

    Combined with Integrations configured in the brainCloud portal you can pipe this data to hundreds of tools for analytics, marketing, and data warehousing.

    CustomPageEvent

    const char* eventName = "testPageEvent";
    const char* jsonEventData; // { "test1": 1332 }
    
    _bc->getDataStreamService()->customPageEvent(
        eventName,
        jsonEventData,
        this
    );
    
    string eventName = "testPageEvent";
    string jsonEventData; // { "test1": 1332 }
    
    _bc.DataStreamService.CustomPageEvent(
        eventName,
        jsonEventData,
        ApiSuccess, ApiError);
    
    public void customPageEvent(String in_eventName, String in_jsonEventProperties, IServerCallback callback)
    
    NSString * eventName = @"testPageEvent";
    NSString * jsonEventData;  // { "test1": 1332 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc dataStreamService]
                      customPageEvent:eventName
            jsonEventProperties:jsonEventData
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    brainCloudClient.dataStream.customPageEvent = function(eventName, eventProperties, callback)
    
    var eventName = "testEvent";
    var eventData = { "test1": 1332 };
    
    var dataStreamProxy = bridge.getDataStreamServiceProxy();
    var retVal = dataStreamProxy.customPageEvent(eventName, eventData);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Creates custom data stream page event

    Service Operation
    "dataStream" "CUSTOM_PAGE_EVENT"
    Method Parameters
    Parameter Description
    eventName The name of the event
    eventProperties The properties of the event

    CustomScreenEvent

    const char* eventName = "testPageEvent";
    const char* jsonEventData; // { "test1": 1332 }
    
    
    _bc->getDataStreamService()->customScreenEvent(
        eventName,
        jsonEventData,
        this
    );
    
    string eventName = "testTrackEvent";
    string jsonEventData; // { "test1": 1332 }
    
    _bc.DataStreamService.CustomScreenEvent(
        eventName,
        jsonEventData,
        ApiSuccess, ApiError);
    
    public void customScreenEvent(String in_eventName, String in_jsonEventProperties, IServerCallback callback)
    
    NSString * eventName = @"testTrackEvent";
    NSString * jsonEventData;  // { "test1": 1332 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc dataStreamService]
                  customScreenEvent:eventName
                jsonEventProperties:jsonEventData
                    completionBlock:successBlock
               errorCompletionBlock:failureBlock
                           cbObject:nil];
    
    brainCloudClient.dataStream.customScreenEvent = function(eventName, eventProperties, callback)
    
    var eventName = "testEvent";
    var eventData = { "test1": 1332 };
    
    var dataStreamProxy = bridge.getDataStreamServiceProxy();
    var retVal = dataStreamProxy.customScreenEvent(eventName, eventData);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Creates custom data stream screen event

    Service Operation
    "dataStream" "CUSTOM_SCREEN_EVENT"
    Method Parameters
    Parameter Description
    eventName The name of the event
    eventProperties The properties of the event

    CustomTrackEvent

    const char* eventName = "testPageEvent";
    const char* jsonEventData; // { "test1": 1332 }
    
    _bc->getDataStreamService()->customTrackEvent(
        eventName,
        jsonEventData,
        this
    );
    
    string eventName = "testTrackEvent";
    string jsonEventData; // { "test1": 1332 }
    
    _bc.DataStreamService.CustomTrackEvent(
        eventName,
        jsonEventData,
        ApiSuccess, ApiError);
    
    public void customTrackEvent(String in_eventName, String in_jsonEventProperties, IServerCallback callback)
    
    NSString * eventName = @"testTrackEvent";
    NSString * jsonEventData;  // { "test1": 1332 }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc dataStreamService]
                       customTrackEvent:eventName
                jsonEventProperties:jsonEventData
                    completionBlock:successBlock
               errorCompletionBlock:failureBlock
                           cbObject:nil];
    
    brainCloudClient.dataStream.customTrackEvent = function(eventName, eventProperties, callback)
    
    var eventName = "testEvent";
    var eventData = { "test1": 1332 };
    
    var dataStreamProxy = bridge.getDataStreamServiceProxy();
    var retVal = dataStreamProxy.customTrackEvent(eventName, eventData);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": null
    }
    

    Creates custom data stream track event

    Service Operation
    "dataStream" "CUSTOM_TRACK_EVENT"
    Method Parameters
    Parameter Description
    eventName The name of the event
    eventProperties The properties of the event

    Entity

    brainCloud User Entities (also called Player Entities) are full json objects (similar to Global Entities) except that are private to a brainCloud user. User entities can be as simple or complex as you would like. All User Entities:

    User Entities are normally retrieved in bulk after a user logs in, and then updated in real-time as the user interacts with them.

    Note that User Entities are by default private (only accessible by the owner), but you can make the accessible to other users via the GetSharedEntityForProfileId and GetSharedEntitiesForProfileId APIs. To do so, you must make them shareable to others via the ACL settings.

    User Entity methods are organized into the following categories:

    Core Access:
    Singleton
    Shared Data

    For more information on how brainCloud organizes data, refer to the Cloud Data Overview.

    CreateEntity

    const char* entityType = "address";
    std::string entityDataJson; // { "street" : "1309 Carling" }
    std::string aclJson; // { "other": 0 }
    
    _bc->getEntityService()->createEntity(
        entityType,
        entityDataJson,
        aclJson,
        this);
    
    string entityType = "address";
    string entityDataJson; // { "street" : "1309 Carling" }
    ACL acl = new ACL(ACL.Access.None);
    
    _bc.EntityService.CreateEntity(
        entityType,
        entityDataJson,
        acl.ToJsonString(),
        ApiSuccess,
        ApiError);
    
    public void createEntity(String entityType, String jsonEntityData, String jsonEntityAcl, IServerCallback callback)
    
    NSString * entityType = @"testTrackEvent";
    NSString * jsonEntityData; // { "street" : "1309 Carling" }
    NSString * jsonEntityAcl = [ACL getAclJson:ReadWrite];
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
                   createEntity:entityType
                 jsonEntityData:jsonEntityData
                  jsonEntityAcl:jsonEntityAcl
                completionBlock:successBlock
           errorCompletionBlock:failureBlock
                       cbObject:nil];
    
    brainCloudClient.entity.createEntity = function(entityType, data, acl, callback)
    
    var entityType = "address";
    var entityData = { "street" : "1309 Carling" };
    var acl = { "other": 0 };
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.createEntity(entityType, entityData, acl);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "entityId": "113db68a-48ad-4fc9-9f44-5fd36fc6445f",
            "entityType": "person",
            "version": 1,
            "data": {
                "name": "john",
                "age": 30
            },
            "acl": {
                "other": 0
            },
            "createdAt": 1395943044322,
            "updatedAt": 1395943044322
        }
    }
    

    Method creates a new entity on the server.

    Service Operation
    "entity" "CREATE"
    Method Parameters
    Parameter Description
    entityType The entity type as defined by the user
    jsonEntityData The entity's data object
    jsonEntityAcl The entity's Access Control List as object. A null ACL implies default permissions which make the entity readable/writeable by only the user.

    DeleteEntity

    const char* entityId = "1234-1234-1234-1234";
    int64_t version; //last known version of the entity
    
    _bc->getEntityService()->deleteEntity(
        entityId,
        version,
        this);
    
    string entityId = "1234-1234-1234-1234";
    int version; //last known version of the entity
    
     _bc.EntityService.DeleteEntity(entityId, version, ApiSuccess, ApiError);
    
    public void deleteEntity(String entityId, int version, IServerCallback callback)
    
    NSString * entityType = @"1234-1234-1234-1234";
    int64_t version; //last known version of the entity
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
                  deleteEntity:entityType
                       version:version
               completionBlock:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    brainCloudClient.entity.deleteEntity = function(entityId, version, callback)
    
    var entityId = "1234-1234-1234-1234";
    var version = 2;
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.deleteEntity(entityId, version);
    
    Show Example JSON Return {}
    {
        "status":200,
        "data":null
    }
    

    Method deletes the given entity on the server.

    This method is affected by versioning. See the versioning documentation for more information.

    Service Operation
    "entity" "DELETE"
    Method Parameters
    Parameter Description
    entityId The entity type as defined by the user
    version The entity's data object
    Error returns
    Code Name Description
    40344 ENTITY_VERSION_MISMATCH The version parameter does not match the current version on the server

    DeleteSingleton

    const char* entityType = "address";
    int64_t version; //last known version of the entity
    
    _bc->getEntityService()->deleteSingleton(
        entityType, version, this);
    
    string entityType = "address";
    int version; //last known version of the entity
    
     _bc.EntityService.DeleteEntity(entityType, version, ApiSuccess, ApiError);
    
    public void deleteSingleton(String entityType, int version, IServerCallback callback)
    
    NSString * entityType = @"address";
    int64_t version; //last known version of the entity
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
               deleteSingleton:entityType
                       version:version
               completionBlock:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    brainCloudClient.entity.deleteSingleton = function(entityType, version, callback)
    
    var entityType = "test";
    var version = 2;
    
    var retVal = entityProxy.deleteEntity(entityType, version);
    
    Show Example JSON Return {}
    {
        "status":200,
        "data":null
    }
    

    Method deletes the given singleton on the server.

    Singletons are defined by their entity type, so no two singletons of the same type can exist at once.

    This method is affected by versioning. See the versioning documentation for more information.

    Service Operation
    "entity" "DELETE_SINGLETON"
    Method Parameters
    Parameter Description
    entityType The entity type as defined by the user
    version The entity's data object
    Error returns
    Code Name Description
    40344 ENTITY_VERSION_MISMATCH The version parameter does not match the current version on the server

    GetList

    std::string whereJson; //{ "entityType" : "testEntity" }
    std::string orderByJson; //{ "data.name" : 1 }
    
    _bc->getEntityService()->getList(
        whereJson, orderByJson, this);
    
    string whereJson; //{ "entityType" : "testEntity" }
    string orderByJson; //{ "data.name" : 1 }
    
     _bc.EntityService.GetList(
        whereJson,
        orderByJson,
        10,
        ApiSuccess, ApiError);
    
    public void getList(String in_whereJson, String in_orderByJson, int in_maxReturn, IServerCallback callback)
    
    NSString * whereJson; //{ "entityType" : "testEntity" }
    NSString * orderByJson; //{ "data.name" : 1 }
    int64_t maxReturn = 10;
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
                   getList:whereJson
               orderByJson:orderBy
                 maxReturn:maxReturn
           completionBlock:successBlock
      errorCompletionBlock:failureBlock
                  cbObject:nil];
    
    brainCloudClient.entity.getList = function(where, orderBy, maxReturn, callback)
    
    var where = { "entityType" : "testEntity" };
    var orderBy = { "data.name" : 1 };
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.getList(where, orderBy, 20);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "entityListCount": 1,
            "entityList": [{
                "gameId": "123455",
                "entityId": "a3def0eb-3993-4a95-8fef-27f50a6d0f69",
                "ownerId": "11c9dd4d-9ed1-416d-bd04-5228c1efafac",
                "entityType": "address",
                "version": 1,
                "data": {
                    "street": "123 Ave"
                },
                "acl": {
                    "other": 1
                },
                "createdAt": 1449870753354,
                "updatedAt": 1449870753354
            }]
        }
    }
    

    Method gets list of entities from the server base on type and/or where clause.

    Fields available for use in the 'where' clause are:

    Along with all custom data (using data.). For more information on the query syntax see here.

    Service Operation
    "entity" "GET_LIST"
    Method Parameters
    Parameter Description
    whereJson Mongo style query string
    orderByJson Specifies the order in which the query returns matching documents. The sort parameter consists of a field followed by an ascending(1)/descending flag(-1). eg. { "name" : 1} sorts by name in ascending order
    maxReturn The maximum number of entities to return

    GetListCount

    std::string whereJson; //{ "entityType" : "testEntity" }
    
    _bc->getEntityService()->getListCount(
        whereJson, this);
    
    string whereJson; //{ "entityType" : "testEntity" }
    
     _bc.EntityService.GetListCount(
        whereJson,
        ApiSuccess, ApiError);
    
    public void getListCount(String in_whereJson, IServerCallback callback)
    
    NSString * whereJson; //{ "entityType" : "testEntity" }
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
              getListCount:whereJson
           completionBlock:successBlock
      errorCompletionBlock:failureBlock
                  cbObject:nil];
    
    brainCloudClient.entity.getListCount = function(where, callback)
    
    var where = { "entityType" : "testEntity" };
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.getListCount(where);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "entityListCount": 5
        }
    }
    

    Method gets a count of entities based on the where clause.

    Fields available for use in the 'where' clause are:

    Along with all custom data (using data.). For more information on the query syntax see here.

    Service Operation
    "entity" "GET_LIST_COUNT"
    Method Parameters
    Parameter Description
    whereJson Mongo style query string

    GetSingleton

    const char* entityType = "address";
    
    _bc->getEntityService()->getSingleton(
        entityType, this);
    
    string entityType = "address";
    
     _bc.EntityService.GetSingleton(entityType, ApiSuccess, ApiError);
    
    public void getSingleton(String entityType, IServerCallback callback)
    
    NSString * entityType = @"address";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
              getSingleton:entityType
           completionBlock:successBlock
       rrorCompletionBlock:failureBlock
                  cbObject:nil];
    
    brainCloudClient.entity.getSingleton = function(entityType, callback)
    
    var entityType = "testEntity";
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.getSingleton(entityType);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "entityId": "113db68a-48ad-4fc9-9f44-5fd36fc6445f",
            "entityType": "person",
            "version": 1,
            "data": {
                "name": "john",
                "age": 30
            },
            "acl": {
                "other": 0
            },
            "createdAt": 1395943044322,
            "updatedAt": 1395943044322
        }
    }
    

    Method retrieves a singleton entity on the server. If the entity doesn't exist, null is returned.

    Service Operation
    "entity" "READ_SINGLETON"
    Method Parameters
    Parameter Description
    entityType The entity type as defined by the user

    GetEntitiesByType

    const char* entityType = "address";
    
    _bc->getEntityService()->getEntitiesByType(
        entityType, this);
    
    string entityType = "address";
    
     _bc.EntityService.GetEntitiesByType(entityType, ApiSuccess, ApiError);
    
    public void getEntitiesByType(String entityType, IServerCallback callback)
    
    NSString * entityType = @"address";
    BCCompletionBlock successBlock;      // define callback
    BCErrorCompletionBlock failureBlock; // define callback
    
    [[_bc entityService]
             getEntitiesByType:entityType
               completionBlock:successBlock
          errorCompletionBlock:failureBlock
                      cbObject:nil];
    
    brainCloudClient.entity.getEntitiesByType = function(entityType, callback)
    
    var entityType = "testEntity";
    
    var entityProxy = bridge.getEntityServiceProxy();
    var retVal = entityProxy.getEntitiesByType(entityType);
    
    Show Example JSON Return {}
    {
        "status": 200,
        "data": {
            "entities": [
                {
                    "entityId": "96f77c80-4257-45ee-aed7-f1c6dd1ac44c",
                    "entityType": "address",
                    "version": 1,
                    "data": {
                        "street": "1309 Carling"
                    },
                    "acl": {
                        "other": 0
                    },
                    "createdAt": 1453926510649,
                    "updatedAt": 1453926510649
                }
            ]
        }
    }
    

    Method returns all user entities that match the given type.

    Service Operation
    "entity" "READ_BY_TYPE"
    Method Parameters
    Parameter Description
    entityType The entity type to search for

    GetEntity

    const char* entityId =