Application configuration: RC app go online process and considerations

RC provides both development and production environments for each app. These environments are data-isolated and use different App Keys. By default, only the development environment is enabled. To use the production environment’s App Key, you’ll need to apply for go online in the RC developer console and get approval. The production environment’s App Key is suitable for official app releases and app store submissions.

:tipping_hand_man: Don’t use the development environment’s App Key for official app releases or app store submissions. If you mistakenly use the development environment’s App Key for a live app, promptly replace the App Key on both the client and server sides with the production environment’s App Key (and update the App Secret on the server side). Notify users who’ve already downloaded the app to force an upgrade. After changing the App Key, all users must get a new Token to connect to RC.

:warning: Service activation is based on the App Key. After successfully going live, you can access and configure the production environment. When the production environment is first activated, All service management switches for the App Key are set to default.. Therefore, you may need to note the services already activated in the development environment and enable them for the production environment’s App Key. Service activation, deactivation, and other settings may take up to 15 minutes to take effect.

Apply for go online in the developer console

  1. Log in to the developer console and select the app you want to apply for go online.

    • Operation from the app details page: Go directly to the app details page and click the Apply for go online button.

  1. Fill in the app description in the pop-up window and confirm that you’ve implemented the logic to reacquire a Token when the TOKEN_INCORRECT error code is returned in the Connect method callback, as shown below:

Note: If the browser checkbox can’t be selected or the apply for go online button can’t be clicked, try a different browser. If it still doesn’t work, submit a ticket or call 400 919 9066 for business consultation.

  1. Once all conditions for applying for go online are met, click the Apply for go online button. A prompt will appear to select an Chat pricing plan. Wait for the review results.

Reference links:

  1. After approval, a new App Key will be assigned to the production environment (online environment) in the App Key section of the developer console.

    Note: The development environment (testing environment) and production environment (online environment) are two separate environments. The app and server side in the same environment must use the same App Key and App Secret; otherwise, a connect exception will occur.

Considerations

  1. Ensure your app has been fully tested in the development environment and is functioning properly. Confirm that the logic to reacquire a Token in the Connect method has been implemented.

    For Android, using the IMLib SDK as an example, refer to the developer documentation for other SDKs:

    public connectIM(String token){
      boolean isCachedLogin == getLoginStatusFromSP(context); //Pseudo code: read whether the user is password-free login from sharedpreference
      int timeLimit = 0;
      if(! isCachedLogin) {
        timeLimit = 5;
      }
      RongIMClient.connect("User Token", timeLimit, new RongIMClient.ConnectCallback() {
        @Override
        public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
            if(RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_SUCCESS.equals(code)) {
                        //Local database opened, navigate to the conversation list page
            } else {
              //Database open failed, show a toast prompt.
            }
          }
    
        @Override
        public void onSuccess(String s) {
            //Connection successful, if no page navigation occurred in onDatabaseOpened(), navigate here.
        }
    
        @Override
        public void onError(RongIMClient.ConnectionErrorCode errorCode) {
            if(errorCode.equals(RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE)) {
                //Request a new token from the app server, then reconnect with the new token
            } else if (errorCode.equals(RongIMClient.ConnectionErrorCode.RC_CONNECT_TIMEOUT)) {
                //Connection timeout, show a prompt, guide the user to retry when the network is stable
            } else {
                //Handle other business error codes accordingly.
            }
        }
        })
    }
    

    For iOS, using the IMLib SDK as an example, refer to the developer documentation for other SDKs:

    [[RCIMClient sharedRCIMClient] connectWithToken:@"Token value obtained by the developer's server through the server API request"
        timeLimit:5
        dbOpened:^(RCDBErrorCode code) {
            //Message database opened, navigate to the main page
        } success:^(NSString *userId) {
            //Connection successful
        } error:^(RCConnectErrorCode status) {
            if (status == RC_CONN_TOKEN_INCORRECT) {
                //Token error, check if the App Key used during SDK initialization matches the one used by the app server to obtain the Token
            } else if(status == RC_CONNECT_TIMEOUT) {
                //Connection timeout, show a prompt, guide the user to retry when the network is stable
            } else {
                //Unable to connect to the IM server, handle the error code accordingly
            }
        }]
    
  2. After successfully applying for go online in the developer console, obtain the production environment’s App Key and App Secret. The Token validity period in the production environment is permanent by default.

  3. Replace the RC App Key and App Secret used on the client and server side with the production environment’s.

Once the above steps are confirmed, your app can run smoothly in the production environment.

More support

For any questions, feel free to submit a ticket.