setCloudProxy method Null safety

Future<void> setCloudProxy(
  1. CloudProxyType proxyType
)

Sets the Agora cloud proxy service.

Since v3.3.1.

When the user’s firewall restricts the IP address and port, refer to Use Cloud Proxy to add the specific IP addresses and ports to the firewall whitelist; then, call this method to enable the cloud proxy and set the proxyType parameter as UDP(1), which is the cloud proxy for the UDP protocol.

After a successfully cloud proxy connection, the SDK triggers the connectionStateChanged(Connecting, SettingProxyServer) callback.

To disable the cloud proxy that has been set, call setCloudProxy(None). To change the cloud proxy type that has been set, call setCloudProxy(None) first, and then call setCloudProxy, and pass the value that you expect in proxyType.

Parameter

proxyType The cloud proxy type, see CloudProxyType. This parameter is required, and the SDK reports an error if you do not pass in a value.

Note

  • Agora recommends that you call this method before joining the channel or after leaving the channel.
  • When you use the cloud proxy for the UDP protocol, the services for pushing streams to CDN and co-hosting across channels are not available.

Implementation

@override
Future<void> setCloudProxy(CloudProxyType proxyType) {
  return _invokeMethod('setCloudProxy', {
    'proxyType': CloudProxyTypeConverter(proxyType).value(),
  });
}