Skip to main content

Network geofencing

To meet the laws and regulations of different countries or regions, the Agora RTC SDK supports geofencing. After enabling geofencing, the SDK only connects to Agora servers within the specified region, regardless of where your app users are located.

For example, if you specify North America as the region for connection, when two users attempt to connect to Agora servers from different locations, the result is as follows:

Specified region for connection App user location Actual region for connection User experience after connection 1
North America North America North America Normal
China Can be less than optimal 2
1 If there is no available server in the specified region, the SDK throws an error.
2 When the user's location is different from the specified region, the public network spanning between the user's location and the specified region might have a poor quality, which can make the audio and video experience less than optimal.
Do not enable geofencing if your scenarios do not have regional restrictions.

Implementation

The area codes support bitwise operation.

Sample code

The following sample code shows how to specify North America as the region for connection.

Page Content