Closed zahyvolf closed 5 years ago
At the moment you could use the GenerateRequestDetails method of WebPushClient, and use your own HttpClient instance.
var httpClient = new HttpClient();
// set your options
var request = webPushClient.GenerateRequestDetails(...);
// override request parameters
await httpClient.SendAsync(request);
A timeout would definitely be helpful. I'll look into it 👍
WebPushClient now has an option to specify your own httpclient in which you can set your own timeout value.
var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(100);
var webPush = new WebPushClient(httpClient);
Is there a plan to add timeout for the the HttpClient? i've noticed the WebPushClient constructor can receive an HttpClientHandler, unfortunately the timeout argument belong to the HttpClient itself which is private/protected.
(The motivation is of course to prevent hangs during SendNotification. I would use the Async method but that would mask the real send failures)