Client configuration

Updated

Configure connection protocol, proxy, and log settings.

Client configuration enables you to customize the behavior of your Signaling client instance according to your app's requirements.

Understand the tech

When initializing a Signaling client instance, configure any or all of the following features:

  • Geographical area access When a user joins a channel, Signaling SDK automatically connects them to the closest geographical region of Agora SDRTN®. However, to comply with local laws and regulations, you may want to specify or restrict connections to a specific geographical area. Agora enables you to control and customize data routing in your app by specifying the Agora SDRTN® region users connect to.

  • Logging Logging enables you to output detailed information from the SDK for locating and fixing problems during the development and testing phases. By configuring logging settings, you can control the amount and type of information logged by the SDK.

  • Data encryption Enabling encryption ensures that only authorized users are able to read messages sent through Signaling. Signaling provides built-in encryption methods that guarantee data confidentiality during transmission. For implementation details, see Data encryption.

Prerequisites

Ensure that you have integrated the Signaling SDK in your project and implemented the framework functionality from the SDK quickstart page.

Configure the client instance

This section explains how to set up and customize various features when you initialize a Signaling client instance.

Geographical area configuration

To specify a geographical area for Agora SDRTN® connections, refer to the following code:

rtmConfig.areaCode = Agora.Rtm.RTM_AREA_CODE.NA;

Log configuration

In the development and testing phase of your app, you may need to output more detailed information to locate and fix problems. Enable log output of the SDK and set the log information level when initializing the Signaling client instance.

using Agora.Rtm;

private IRtmClient rtmClient;

LogConfig logConfig = new LogConfig()
// Set log file path.
logConfig.filePath = "./logfile/";
// Set log file size.
logConfig.fileSizeInKB = 512;
// Set log report level.
logConfig.level = LOG_LEVEL.INFO;

RtmConfig config = new RtmConfig();
// Initialize logConfig.
config.logConfig = logConfig;
config.appId = "your_appId";
config.userId = "your_userId";
try
{
    rtmClient = RtmClient.CreateAgoraRtmClient(config);
    Debug.Log("RTM Client Initialize Sucessfull");
}
catch (RTMException e)
{
    Debug.Log(string.Format("{0} is failed.", e.Status.Operation ));
    Debug.Log(string.Format("Error code: {0}, due to: {1}", e.Status.ErrorCode, e.Status.Reason));
}

Choose the log level from the following:

Enumeration ValueDescription
NONE0x0000: Do not output any logs.
INFO0x0001: Output logs of levels FATAL, ERROR, WARN, and INFO. Best practice is to set the log level to this option.
WARN0x0002: Only output logs of levels FATAL, ERROR, and WARN.
ERROR0x0004: Only output logs of levels FATAL and ERROR.
FATAL0x0008: Only output logs at the FATAL level.

When your app is released to production, set the log level to INFO.

Reference

This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

For firewall configuration, see firewall requirements