Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better detection of websocket availability on asp.net host.

  • Loading branch information...
commit 1f6948ce9259a008801eb8d03bf009d71969be1b 1 parent 4861874
@davidfowl davidfowl authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 SignalR.Hosting.AspNet/AspNetHandler.cs
View
9 SignalR.Hosting.AspNet/AspNetHandler.cs
@@ -1,4 +1,5 @@
-using System.Threading;
+using System;
+using System.Threading;
using System.Threading.Tasks;
using System.Web;
@@ -12,6 +13,8 @@ public class AspNetHandler : HttpTaskAsyncHandler
private readonly PersistentConnection _connection;
private readonly IDependencyResolver _resolver;
+ private const string WebSocketVersionServerVariable = "WEBSOCKET_VERSION";
+
public AspNetHandler(IDependencyResolver resolver, PersistentConnection connection)
{
_resolver = resolver;
@@ -35,10 +38,8 @@ public override Task ProcessRequestAsync(HttpContextBase context)
var response = new AspNetResponse(context);
var hostContext = new HostContext(request, response);
-#if NET45
// Determine if the client should bother to try a websocket request
- hostContext.Items[HostConstants.SupportsWebSockets] = true;
-#endif
+ hostContext.Items[HostConstants.SupportsWebSockets] = !String.IsNullOrEmpty(context.Request.ServerVariables[WebSocketVersionServerVariable]);
// Set the debugging flag
hostContext.Items[HostConstants.DebugMode] = context.IsDebuggingEnabled;
Please sign in to comment.
Something went wrong with that request. Please try again.