Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed Issue #522 Silverlight Caching of negotiate #531

Merged
merged 5 commits into from

4 participants

@davidhess

Fixed the Issue #522 where the Browser is caching the negotiate response.
Added DateTime.Now.Ticks as param to the negotiate and connection / reconnecting request.

This only applies to Silverlight and Windows Phone Client.

@samueldjack

I'm not sure that this will fix the caching problem in our case, because we can potentially have multiple Negotiate requests issued within a few hundred milliseconds of each other, so they would get the same noCache parameter. How about DateTime.Now.Ticks.ToString()?

Thanks for the hint. I will change the GetNoCacheUrlParam to Ticks.Should we consider using the noCache Param in .net Client, too? I Think not because this seems to be an browser issue.

I think you're right that it is just a browser issue, so the .Net client should be fine.

@davidfowl davidfowl merged commit 23dd63a into SignalR:master
@DamianEdwards

As you've contributed to SignalR in the past, I need to contact you regarding some changes we're planning to the copyright and license. Can you please email me at dedward@microsoft.com.

Regards,
Damian Edwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 SignalR.Client/Transports/HttpBasedTransport.cs
View
16 SignalR.Client/Transports/HttpBasedTransport.cs
@@ -36,7 +36,12 @@ public Task<NegotiationResponse> Negotiate(IConnection connection)
internal static Task<NegotiationResponse> GetNegotiationResponse(IHttpClient httpClient, IConnection connection)
{
- string negotiateUrl = connection.Url + "negotiate";
+#if SILVERLIGHT || WINDOWS_PHONE
+ string negotiateUrl = connection.Url + "negotiate?" + GetNoCacheUrlParam();
+#else
+ string negotiateUrl = connection.Url + "negotiate";
+#endif
+
return httpClient.GetAsync(negotiateUrl, connection.PrepareRequest).Then(response =>
{
@@ -116,9 +121,18 @@ protected string GetReceiveQueryString(IConnection connection, string data)
.Append(customQuery);
}
+#if SILVERLIGHT || WINDOWS_PHONE
+ qsBuilder.Append("&").Append(GetNoCacheUrlParam());
+#endif
return qsBuilder.ToString();
}
+ private static string GetNoCacheUrlParam()
+ {
+ //Updated to Ticks according to Samual Jack's comment
+ return "noCache=" + DateTime.Now.Ticks.ToString();
+ }
+
protected virtual Action<IRequest> PrepareRequest(IConnection connection)
{
return request =>
Something went wrong with that request. Please try again.