Skip to main content

You are viewing Agora Docs forBeta products and features. Switch to Docs

Connect through restricted networks

You use a proxy connection to ensure reliable connectivity for your users when they connect from an environment with a restricted network.

Understand the tech

To accommodate your end users’ firewall settings and business needs, Signaling SDK enables you to connect using a TCP proxy server.

The steps you need to implement in your app are:

  1. Set proxy configuration

  2. Apply the configuration to the Signaling Engine


To follow this page, you must:

Implement communication using a TCP proxy

This section shows how to connect to Signaling using a third-party TCP proxy server.

Set proxy configuration

// Define proxy configuration
val proxyConfig = RtmProxyConfig(RtmConstants.RtmProxyType.HTTP,
"<your proxy server domain name or IP address>",
8080, // Your proxy server listening port,
"<proxy login account>", // Optional
"<proxy login password>" // Optional

Apply the configuration to the Signaling Engine

try {
val rtmConfig = RtmConfig.Builder(appId, uid.toString())
.proxyConfig(proxyConfig) // Set proxy configuration
signalingEngine = RtmClient.create(rtmConfig)
localUid = uid
} catch (e: Exception) {
return false

Test proxy connection

To test your proxy connection:

  1. Configure the project

    1. Open the file <samples-root>/signaling-manager/src/main/res/raw/config.json

    2. Set appId to the AppID of your project.

    3. Choose one of the following authentication methods:

      • Temporary token:
        1. Generate an RTM token using your uid.
        2. Set token to this value in config.json.
      • Authentication server:
        1. Setup an Authentication server
        2. In config.json, set:
          • token to an empty string.
          • serverUrl to the base URL for your token server. For example:
  2. Run the reference app

    1. In Android Studio, connect a physical Android device to your development machine.
    2. Click Run to start the app.
    3. A moment later you see the project installed on your device.
  3. Test proxy connection:

    1. Open a new instance of the reference app.
    2. Choose the Connect through restricted networks example.
    3. Log in to Signaling.
    4. Subscribe to a channel.
      You see your app starts the proxy service and magically connects to the Agora SD-RTN™ which was not possible in a restricted network environment.


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