feat(llc): Deprecate location in favor of edge server.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-01-17 18:55:17 +05:30
committed by xsahil03x
parent 512d68af63
commit c0ae7a8768
4 changed files with 13 additions and 49 deletions
@@ -66,8 +66,11 @@ class StreamChatClient {
this.logLevel = Level.WARNING,
LogHandlerFunction? logHandlerFunction,
RetryPolicy? retryPolicy,
Location? location,
@Deprecated('Use location to change baseUrl instead') String? baseURL,
@Deprecated('''
Location is now deprecated in favor of the new edge server. Will be removed in v4.0.0.
Read more here: https://getstream.io/blog/chat-edge-infrastructure
''') Location? location,
String? baseURL,
Duration connectTimeout = const Duration(seconds: 6),
Duration receiveTimeout = const Duration(seconds: 6),
StreamChatApi? chatApi,
@@ -79,7 +82,6 @@ class StreamChatClient {
final options = StreamHttpClientOptions(
baseUrl: baseURL,
location: location,
connectTimeout: connectTimeout,
receiveTimeout: receiveTimeout,
headers: {'X-Stream-Client': defaultUserAgent},
@@ -1,32 +1,20 @@
part of 'stream_http_client.dart';
const _defaultBaseURL = 'https://chat-us-east-1.stream-io-api.com';
const _defaultBaseURL = 'https://chat.stream-io-api.com';
/// Client options to modify [StreamHttpClient]
class StreamHttpClientOptions {
/// Instantiates a new [StreamHttpClientOptions]
const StreamHttpClientOptions({
String? baseUrl,
this.location,
this.connectTimeout = const Duration(seconds: 6),
this.receiveTimeout = const Duration(seconds: 6),
this.queryParameters = const {},
this.headers = const {},
}) : _baseUrl = baseUrl ?? _defaultBaseURL;
final String _baseUrl;
}) : baseUrl = baseUrl ?? _defaultBaseURL;
/// base url to use with client.
String get baseUrl {
if (location == null) return _baseUrl;
const serviceName = 'chat';
final locationName = location!.name;
const baseDomainName = 'stream-io-api.com';
return 'https://$serviceName-proxy-$locationName.$baseDomainName';
}
/// data center to use with client
final Location? location;
final String baseUrl;
/// connect timeout, default to 6s
final Duration connectTimeout;