Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Models/ClientOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Net;
using System.Net.Http;
using StreamChat.Exceptions;

Expand All @@ -9,7 +10,10 @@ namespace StreamChat.Models
/// </summary>
public class ClientOptions
{
private static readonly HttpClient DefaultHttpClient = new HttpClient();
private static readonly HttpClient DefaultHttpClient = new HttpClient(new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip,
});

/// <summary>The <see cref="System.Net.Http.HttpClient"/> instance used for underlying HTTP calls.</summary>
public HttpClient HttpClient { get; set; } = DefaultHttpClient;
Expand All @@ -29,6 +33,7 @@ static ClientOptions()
// AWS load balancer disconnects in 60 seconds, so let's make it 59
var socketsHandler = new SocketsHttpHandler();
socketsHandler.PooledConnectionLifetime = TimeSpan.FromSeconds(59);
socketsHandler.AutomaticDecompression = DecompressionMethods.GZip;
DefaultHttpClient = new HttpClient(socketsHandler);
}
#endif
Expand Down
Loading