I used Socket.io on Node on and I like it.
I would like to use SignalR. But I heard WebSocket is not supported on Windows 7, which I use. I did some search and seems the reason is that WebSocket uses some Windows lib to handle WebSocket TCP.
But since SignalR is opensource on Github and Websocket is technically possible on Windows 7, I am wondering if there is or could be a fork of SignalR that support WebSocket on Windows 7. If not, is there any technical or legal reason?
WebSockets are not supported in Windows 7 if you are using ASP.NET. The only public implementations of client and server WebSockets are supported on Windows 8 and Windows Server 2012.
Here are the requirements to use websockets:
The WebSocket Protocol was introduced in IIS 8.0.
.NET Framework 4.5
Windows 8 or Windows Server 2012.
Related
I have a relatively simple web application that I am currently porting to asp.net 5. The current version runs under IIS on some Windows 7 and Server 2008 machines.
With the next version of my software I would like to connect a C++ client via SignalR to the web application. The problem is that the current version of the new Signalr-Cpp client only supports SignalR via websockets.
IIS on Windows 7 and Server 2008 does not support websockets, though.
Since a self-hosting solution would be fine for me, my question is:
Is it possible to support Signalr via websockets on Windows 7 / Server 2008 when the web app is self-hosted?
Update:
I would accept
does self hosted signalr require windows server 2012 in order to use websockets? as an answer if there wasn't this small comment by Damian Edwards in the following Tweet by David Fowler which says
although, with v3, websockets in a self-hosted server (like Katana) is possible
Does this change the situation?
Final update
At least with beta 6 it works on Windows 7 when hosting the app with Kestrel and including the middleware Microsoft.AspNet.WebSockets.Server.
It's not possible...
SignalR Supported Platforms
for SignalR to use WebSockets, Windows Server 2012 or Windows 8 is
required
Does self hosted signalr require windows server 2012 in order to use websockets
HTTP.SYS prior to Windows 8/2012 has no built in support for
WebSockets, so although .NET 4.5 contains WebSocket classes, they
won't work unless you are running .NET 4.5+ on Windows 8/2012 and that
will affect self-hosting solutions running in Windows < 8.
UPDATE:
My answer is valid for current release version of SignalR (2.2). Tweets you included (quite old btw) suggest this will be possible in v3 but its not released yet, there is not much info on Internet about changes\features of this release and I even can't find anything about WebSocket support in Katana on Win < 8 in list of Github issues for v3
I understand that SignalR is used to communicate with client browsers using the injected artery script. I have what seems to be a common problem, which is that my browser's network log is filled with entries that look like this:
.../arterySignalR/poll?transport=longPolling&connectionToken=...
This tells me that SignalR has fallen back to long polling instead of using web sockets. Assuming that we have a browser that supports web sockets, and that browser is running on the localhost, shouldn't SignalR default to using web sockets? What might cause it to fall back to long polling?
Short answer
Browser Link will only use WebSockets on Windows 8 or Windows Server 2012
Longer answer
The following would explain the issue if you're using Visual Studio on Windows 7, Windows Vista or Windows Server 2008:
IIS (Express) depends on the .NET framework implementation in System.Net.WebSockets to handle WebSocket connections; as you can read in the link to MSDN, you simply don't get an actual implementation of the necessary classes when you install .NET 4.5 on Windows 7.
So in that case, the server can't agree to the client's request to change from standard HTTP to the WebSocket protocol, which forces the SignalR client to use one of the fallback options (in your case: long-polling).
I installed the SignalR package when our project was running .net 4.0. We since upgraded to 4.5 and I want to support WebSockets. I uninstalled Signal packages and reinstalled SignalR (per this answer). However the SignalR DLL versions (1.1.0/1.1.3) are identical in both cases.
Here is my configuration:
ASP.NET 4.5
IIS 8.0 (Windows Server 2012)
WebSockets feature enabled on the server
A WebSocket supporting browser (latest version of Firefox)
Even though I have all these required things, I still get this:
{"Url":"/signalr","ConnectionToken":"Yy6qHcSMMm4vPl9i3ungxJ5aa2P0SJh4UoU4pelAyFcMud0596UaeB6x8AmhZ2SxW_MPk23QXrKGkwar7LjLLnWlBZx1nokd6LRe96k8D-Oua3kSnKsyDa1RrPTE0n9FyaUO9rK3caLfue20Dmx5UkB9F2TKusPD4PDqQw2","ConnectionId":"b7b00e98-3128-4fbb-ba63-fb16f922f168","KeepAliveTimeout":20.0,"DisconnectTimeout":30.0,"TryWebSockets":false,"WebSocketServerUrl":null,"ProtocolVersion":"1.2"}
I guess the important parts are:
"TryWebSockets":false,"WebSocketServerUrl":null,"ProtocolVersion":"1.2"
Does this mean that I am not using WebSockets? What could I be missing?
Thanks so much.
WebSockets are supported in all major versions of SignalR.
Therefore the question is "what is required for my SignalR application to use WebSockets?"
ASP.NET 4.5
IIS 8.0 (Windows Server 2012 or Windows 8)
WebSockets feature enabled on the server
A WebSocket supporting browser
Now that we've established what is required to have a WebSocket enabled application it seems that your missing the enabling of the WebSockets feature.
To enable WebSockets on your server follow the "Step by Step instructions" here.
Hope this helps!
I know your problem - the same that hit ours!
Your problem is the client you are running from.
The client Windows stack must be > Windows7 to use WebSockets on a
.Net Client
This caught us too!
Browsers aren't affected as they have their own WebSocket stack, but the Windows .Net networking stack doesn't have WebSockets.
Windows 8/Windows 2012 and IIS 8 fixes that.
This is why the SignalR load tester (crank) can't use WebSockets when run on Windows7, only in Windows 2012 (regardless of server)
We since upgraded to 4.5 and I want to support WebSockets.
I'm running Windows 2012 Server, IIS 8, WebSockets feature installed on server and I still get this
Since you are using ASP.NET 4.5, IIS 8 and Windows Server 2012, the problem should be relying on how you migrated the project to .NET framework 4.5 or with the browser. Given that most of the modern web browsers support web sockets, I highly doubt your references are still for the .NET framework 4.0.
Try by creating a new project using .NET framework as 4.5. Simply setting the target using project properties sometimes doesn't update the assemblies.
I have a bit of an issue.
I am using the self-hosting example (http://www.asp.net/signalr/overview/getting-started/tutorial-signalr-self-host) and I have installed the 2.0 (beta2) packages from nuget.
I have my hub running on a webserver and my js client on my localhost.
Webserver is windows server 2012 with websockets enabled in roles.
My solution is set to target .NET 4.5 BUT has started out as 4.0. I have installed the nuget packages AFTER changing the solution target.
Client is running IE9 on Win7.
Now, when I check my referenced .dll's in Visual Studio their Runtime version is listed as 4.0. I am unsure if this means anything.
My problem is, I cannot connect my JS client to the hub, IF I tell it to use websockets.
If I don't specify websockets as transport, it connects fine, through longpolling.
What do I do? I have no idea what to try next.
IE9 does not support web sockets.
Where can I download websocket server for Windows. Easy to install. Different from node.js I have already tried this one and couldn't manage to run it on my computer.
If you are developing for Windows you'll probably be using .NET. Here are a few .NET WebSocket server options (I'll also be updating this realtime technologies guide with tech as I find them).
XSockets
SuperWebSocket
WebSync (which works with IIS)
Pokein