Skip to content

Commit 5e81a6e

Browse files
committed
Stop reusing httpclient instances for WNS
This hopefully will work for #619
1 parent 9029bd1 commit 5e81a6e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

PushSharp.Windows/WnsConnection.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,11 @@ public WnsServiceBroker (WnsConfiguration configuration) : base (new WnsServiceC
3939
}
4040

4141
public class WnsServiceConnection : IServiceConnection<WnsNotification>
42-
{
43-
HttpClient http;
44-
42+
{
4543
public WnsServiceConnection (WnsConfiguration configuration, WnsAccessTokenManager accessTokenManager)
4644
{
4745
AccessTokenManager = accessTokenManager;
4846
Configuration = configuration;
49-
50-
//TODO: Microsoft recommends we disable expect-100 to improve latency
51-
// Not sure how to do this in httpclient
52-
http = new HttpClient ();
5347
}
5448

5549
public WnsAccessTokenManager AccessTokenManager { get; private set; }
@@ -64,6 +58,10 @@ public async Task Send (WnsNotification notification)
6458
//Authorization: Bearer {AccessToken}
6559
//
6660

61+
//TODO: Microsoft recommends we disable expect-100 to improve latency
62+
// Not sure how to do this in httpclient
63+
var http = new HttpClient ();
64+
6765
http.DefaultRequestHeaders.TryAddWithoutValidation ("X-WNS-Type", string.Format ("wns/{0}", notification.Type.ToString ().ToLower ()));
6866
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + accessToken);
6967

0 commit comments

Comments
 (0)