Http / 2 HttpClient and HPACK for APN

I am writing code to send notifications to Apple's push notification (APN) servers. The docs say it requires HTTP / HPACK header compression. I found the following code to use HTTP / 2 with C # httpclient :

 public class Http2CustomHandler : WinHttpHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { request.Version = new Version("2.0"); return base.SendAsync(request, cancellationToken); } } using (var httpClient = new HttpClient(new Http2CustomHandler())) { } 

Does it compress the headers that I will add to the HttpClient, or should I add the header data in another way?

+5
source share

Source: https://habr.com/ru/post/1271256/


All Articles