logo
On this page

Cloud Proxy

2024-01-30

Introduction

By setting the SDK's cloud proxy interface, all traffic corresponding to the SDK is forwarded through the cloud proxy server to communicate with RTC, L3 (Ultra-Low Latency Live Streaming).

Warning
  • The "Cloud Proxy" feature is a paid feature. If you need to use this feature, please contact ZEGO business personnel for consultation.
  • After opening the cloud proxy service, if the enterprise has configured a firewall, you also need to add the IP, domain name, and port used by the cloud proxy to the enterprise firewall whitelist.

Currently, ZEGO provides two modes: Normal Cloud Proxy and Smart Cloud Proxy. Developers can choose the appropriate cloud proxy mode according to your business needs.

Normal Cloud ProxySmart Cloud Proxy
Solution DescriptionWhen initializing the SDK, use the cloud proxy mode directly.

When initializing the SDK, prioritize using the direct connection network mode for attempting.

  1. If there is network connectivity within 1 second, continue using the direct connection mode.
  2. If there is no network connectivity within 1 second:

    • If the current network is cellular, continue to stay in direct connection mode and retry.
    • If the current network is non-cellular, switch to cloud proxy mode.

When the network switches, if network connectivity is detected and the current mode is direct connection, it will attempt directly according to the SDK initialization logic.

Applicable ScenariosWhen you are in restrictive network environments such as hospitals, governments, and companies with internal networks, and want to use public cloud RTC or L3 services.When your users are in scenarios with both public networks and restrictive networks, and you cannot judge the user's network usage, and want to prioritize using public cloud RTC or L3 services, and then use cloud proxy services when public cloud RTC or L3 services are unavailable.

Prerequisites

Before using the cloud proxy, ensure that:

Usage Process

1 Open the cloud proxy service

Apply to ZEGO Technical Support to open the cloud proxy service. After opening the service, developers will obtain a cloud proxy domain name and port information.

2 Configure cloud proxy

Call setCloudProxyConfig to configure the cloud proxy.

Warning

This interface must be called before calling the createEngine interface to create the engine.

  • Interface prototype
/**
 * Set cloud proxy.
 *
 * This interface needs to be called before createEngine.
 * After calling this interface, all network requests and sending of the sdk will be forwarded through the cloud proxy.
 *
 * @param proxyList Cloud proxy information list, supports setting multiple cloud proxy information.
 * @param token Authentication token. If the customer uses appsign for authentication, this can be empty. Otherwise, the token must be filled in.
 * @param enable Whether to enable cloud proxy.
 */
static void setCloudProxyConfig(const std::vector<ZegoProxyInfo> &proxyList,
    const std::string &token, bool enable)
  • Call example
ZegoProxyInfo proxy;
// Domain name and port, filled in by developers according to what was obtained when opening the cloud proxy service
proxy.hostName = "xxxxxxxxxxx.zego.im";
proxy.port = 1080;
std::vector<ZegoProxyInfo> infos;
infos.push_back(proxy);
ZegoExpressSDK::setCloudProxyConfig(infos, "", true);

FAQ

  • Ensure that the cloud proxy service has been opened and valid proxy port and domain name have been obtained.
  • Ensure that the cloud proxy is set correctly before createEngine, and mid-way modification is not supported.

Yes, for details please refer to Local Proxy.

Previous

Traffic Control

Next

Geofencing

On this page

Back to top