Multi-region Support

LAST EDIT Feb 16 2021

Stream's Chat infrastructure is partially replicated on several regions, allowing developers all around the globe to optimize for network latency by mapping their usage to the region closest to their users. There is support for Chat in US East, EU West, Singapore and Sydney.

Users can now arbitrarily create apps in the location of their choice, without any action or approval needed from our side. Two steps are required to do so :

Dashboard Server LocationCopied!

For Chat, users will first choose hosting their app in our US East, EU West or Singapore server instances.

Client Location SettingsCopied!

In order to ensure region matching between your dashboard app configuration and your API client (meaning for your API client to send request to the server location you've selected), you will need to manually set the base URL with your location like the following :

1
2
3
4
5
6
7
8
9
10
11
//Set the client server location to EU West region 
client.setBaseURL('https://chat-proxy-dublin.stream-io-api.com'); 
 
//Set the client server location to US-East region 
client.setBaseURL('https://chat-proxy-us-east.stream-io-api.com'); 
 
//Set the client server location to Singapore region 
client.setBaseURL('https://chat-proxy-singapore.stream-io-api.com'); 
 
//Set the client server location to Sydney region 
client.setBaseURL('https://chat-proxy-sydney.stream-io-api.com');
1
2
3
4
5
6
7
8
// You can set a predetermined baseURL that Stream offers 
Client.configureShared(.init(apiKey: YOUR_API_KEY, baseURL: .dublin)) 
// or 
Client.configureShared(.init(apiKey: YOUR_API_KEY, baseURL: .usEast)) 
// or, you can just use a string 
Client.configureShared(.init(apiKey: YOUR_API_KEY, baseURL: "https://chat-proxy-singapore.stream-io-api.com/")!) 
// or 
Client.configureShared(.init(apiKey: YOUR_API_KEY, baseURL: "https://chat-proxy-sydney.stream-io-api.com/")!)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// EU West - Dublin region 
val dublinClient = ChatClient.Builder("{{ api_key }}", context) 
    .baseUrl("https://chat-proxy-dublin.stream-io-api.com/") 
    .build() 
 
// US East region 
val usEastClient = ChatClient.Builder("{{ api_key }}", context) 
    .baseUrl("https://chat-proxy-us-east.stream-io-api.com/") 
    .build() 
 
// Singapore region 
val singaporeClient = ChatClient.Builder("{{ api_key }}", context) 
    .baseUrl("https://chat-proxy-singapore.stream-io-api.com/") 
    .build() 
 
// Sydney region 
val sydneyClient = ChatClient.Builder("{{ api_key }}", context) 
    .baseUrl("https://chat-proxy-sydney.stream-io-api.com/") 
    .build()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// EU West - Dublin region 
ChatClient dublinClient = new ChatClient.Builder("{{ api_key }}", context) 
        .baseUrl("https://chat-proxy-dublin.stream-io-api.com/") 
        .build(); 
 
// US East region 
ChatClient usEastClient = new ChatClient.Builder("{{ api_key }}", context) 
        .baseUrl("https://chat-proxy-us-east.stream-io-api.com/") 
        .build(); 
 
// Singapore region 
ChatClient singaporeClient = new ChatClient.Builder("{{ api_key }}", context) 
        .baseUrl("https://chat-proxy-singapore.stream-io-api.com/") 
        .build(); 
 
// Sydney region 
ChatClient sydneyClient = new ChatClient.Builder("{{ api_key }}", context) 
        .baseUrl("https://chat-proxy-sydney.stream-io-api.com/") 
        .build();
1
2
3
4
5
// possible locations 
$client->setLocation("us-east"); 
$client->setLocation("dublin"); 
$client->setLocation("sidney"); 
$client->setLocation("tokyo");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// EU West - Dublin region 
final client = Client( 
  apiKey, 
  baseUrl: 'https://chat-proxy-dublin.stream-io-api.com/', 
); 
 
// US East region   
final client = Client( 
  apiKey, 
 baseUrl: 'https://chat-proxy-us-east.stream-io-api.com/', 
); 
 
// Singapore region   
final client = Client( 
  apiKey, 
  baseUrl: 'https://chat-proxy-singapore.stream-io-api.com/', 
); 
   
// Sydney region 
final client = Client( 
  apiKey, 
  baseUrl: 'https://chat-proxy-sydney.stream-io-api.com/', 
);