-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use managed WebSockets implementation on all Windows (not UWP) #17644
Comments
@stephentoub, (bit off-topic) is there a major performance difference when switching to managed version of WebSockets on Windows 10, for example? |
See some numbers in my PR here: |
Any news here? is it planed to be released on milestone 1.2.0 ? April 2017 ? I think that we need a solution now for Windows 7! What do you think? |
@stephentoub I believe it's good to have an implementation of WebSockets for Win7 as long as this implementation is not replacing the WinHttp based one for Win8+. |
@ericstj, we can specialize the package in this way, right? i.e. have a build for Win7 and a different one for Win8+?
I don't, but if you list out the features, I can share which the managed does/doesn't currently support. Some of the limitations are things it looks like the WinHTTP implementation isn't respecting anyway, e.g. we don't currently pay attention to the ClientWebSocketOptions.Proxy in the managed implementation (should be relatively straightforward to add, though), but then looking at the WinHTTP implementation, it appears to ignore it as well. |
Answering this is definitely not an easy task given the large RFCs for both HTTP/S and WebSockets. Here are a few of WinHTTPs features as well as a link to the WS RFC: https://msdn.microsoft.com/en-us/library/windows/desktop/aa382925(v=vs.85).aspx
This is correct and the expectation is set via the following issues: #15994, #14911. |
I've added my idea of an implementation plan in https://github.com/dotnet/corefx/issues/13663#issuecomment-265879275. The plan can be split to handle this item (leave the code in S.N.WebSocket.Client but add an OS platform check). Since we already have some of the testing done and most code shouldn't change, working on this item should be fairly easy (but adding extra tests is always welcomed). Requires Win7/ |
Bump, is there any progress on this? We've stumbled upon this exact issue in dotnet/corefx#24249 as well as SteamRE/SteamKit#455. It'd probably be a good idea to address this. |
We really need this to support R in VS Code. Many R users are on Win7 |
Please issue a managed websocket package for Windows Server 2008 R2 and one for Windows 7. |
Desperately need |
If people are in a crunch there are a bazillion pure managed implementations out there. My issue is that the kestrel websocket add-on fails due to this bug, so I now have to write my own plugin for kestrel. |
The implementation that's used here on Unix is managed, built on sockets. |
Kestrel doesn’t fail due to this. Do you mean kestrel with IIS fails? |
@davidfowl No I meant just straight up kestrel. I have a library that uses Kestrel to run a local transparent filtering proxy and it collapses on Windows 7 with platform not supported exception because I use the kestrel websocket addon. |
Windows 7 x64 home and pro, all up to date. |
Ah my bad it looks like it's failing on the creation of WebSocket, not on the acceptance of the kestrel websocket (they are not the same class). My bad @davidfowl |
We should try and get this work done for 2.1 and repackage the IL only version for win7. |
Yes please do. Also full support for duplex contracts using websockets too. |
@weshaggard good call. Somebody give this guy a promotion. |
@stephentoub @davidsh is there any reason we cannot just use the IL only implementation on all platforms? That will make fixing this a lot easier. |
Personally I'd be happy with that. However there may be some functional gaps we're not aware of, things that WinHTTP is providing that the managed implementation currently doesn't have (I don't have any examples, though). |
The "pure managed" implementation of WebSockets.Client is missing features compared to the current Windows implementation (which uses native WinHTTP). So, it is not ready to be used as the replacement. Also, the UWP version of WebSockets.Client currently uses WinRT WebSocket APIs. So, we can't just remove those implementations yet since the managed one is not at feature parity. |
@davidsh, which features specifically? |
proxy and HTTP authentication for starters. |
I don't see the Windows implementation accessing the relevant members of ClientWebSocketOptions... can you point me to where that's happening? i.e. where is it accessing Credentials/_credentials or Proxy/_proxy? |
Honestly I don’t care if some features are missing (that is better than nothing). Let’s simply add support for Win7 as a managed code and by checking platform, upgrade to a system provided solution on win8+, etc. This is much better than not all that great third party solutions that also have licensing issues for many people.
Thanks
-Wes
[EDIT] @karelz removed email reply
|
Given that in 2.0 this ships in the shared framework instead of an individual library package it will be tricky to have a win7 and win10 specific implementation because we only produce one shared framework for windows which is the portable win one. I don't think we want to complicate everything else consuming the .NET Core shared framework on windows to not start shipping 2 just for this library so we need another solution. Possible solutions I see are:
I don't think we want option (1) and option (2) will have various complications and folks will have to explicitly opt-in by adding that reference. So I think either (3) or (4) is our best option. |
It might not be using it right now since we have the other issue with ClientWebSocketOptions not being implemented. But adding that code would simply use the built-in mechanisms for proxy and HTTP auth for the Windows platforms. I suppose in the scheme of things it might not matter. If someone wants to do an experiment with removing the WinHTTP version for Windows and simply using the managed WebSockets.Client everywhere (except for UWP), we can see where we land in terms of test failures, etc. |
I see number 3 as the current goal for now. |
FWIW, that's a very easy experiment to do. The src .csproj contains this:
By changing it to:
and rebuilding, then running the tests, I get:
Those two failures are due to this assert: Obviously take this with a grain of salt. Our test scenario coverage isn't exactly stellar. |
Ok. Well, then it looks like the fix for this issue is to simply dump the WinHTTP version and use the managed WebSockets.Client implementation everywhere except UWP. Then as we add features for supporting ClientWebSocketOptions, we'll need to add platform-specific code to handle HTTP auth (at least for the hard stuff like Negotiate and NTLM) and proxy detection logic. I'm not opposed to you doing such a PR and also cleaning up (deleting) the (now) obsolete WinHTTP implementation. |
I was actually proposing [4].
[EDIT] @karelz email reply text removed - https://github.com/dotnet/corefx/issues/9503#issuecomment-348625061
|
In internal discussion we found out that shipping the package just for Win7 is difficult and problematic. We are going with option [3] above -- use managed WebSockets for all Windows (except UWP). Title updated. More details on the risk assessment from @davidsh (thanks!)
|
😍 this is great news |
This is excellent! Lets invest energies in making the ManagedWebSocket the BEST and most performant implementation, zero copy, memory pools and and and.. all the goodness one can possible imagine these days Btw, how where do we get the preview System.Net.WebSockets package today? When I searched |
@kasper3 lol feel free to submit a PR. |
@kasper3 if you open the drtails for that package, you should see preview1 builds which are much more recent. You'll want those. |
See this comment on how to get the latest build: https://github.com/dotnet/corefx/issues/5120#issuecomment-348617702 |
@qmfrederik How did you manage to make this work on Windows? Maybe I'm thick lately but following the bread crumbs of your comments has not led me to a solution. |
@TechnikEmpire What I did was to clone the CoreFX repository, edit
and then building that project. You'll probably want to build corefx from the root first if you haven't done so already. It should get you a System.Net.WebSockets.Client.dll library you can use. I copied that dll to the NuGet cache folder so my projects would always use the modified version. |
Now that we have a managed implementation of Websockets that we use on Unix, should we also use it on Windows pre-Windows 8, since the current Windows implementation requires OS support only available Windows 8 and later? I'm assuming this should mostly be an issue of package authoring?
cc: @davidsh, @CIPop, @ericstj, @davidfowl
The text was updated successfully, but these errors were encountered: