Skip to content

Use managed WebSockets implementation on all Windows (not UWP) #17644

Closed
dotnet/corefx
#26429

Description

@stephentoub

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

Activity

  1. stephentoub commented on Jun 17, 2016

    @stephentoub
    MemberAuthor

    (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:
    dotnet/corefx#9412

  2. meriturva commented on Sep 28, 2016

    @meriturva

    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?

  3. CIPop commented on Sep 29, 2016

    @CIPop
    Contributor

    @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+.
    The only downside is that the managed implementation is lacking a full implementation of the HTTP protocol required for the upgrade. To set the correct expectations: do you have a feature comparison table between the managed and WinHttp-based implementations?

  4. stephentoub commented on Sep 29, 2016

    @stephentoub
    MemberAuthor

    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+?

    To set the correct expectations: do you have a feature comparison table between the managed and WinHttp-based implementations?

    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.

  5. CIPop commented on Sep 29, 2016

    @CIPop
    Contributor

    I don't, but if you list out the features, I can share which the managed does/doesn't currently support

    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

    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

    This is correct and the expectation is set via the following issues: #15994, #14911.
    If I correctly recall, the contract is also missing a few tests and requires further unification with WinHttpHandler. /cc: @davidsh

  6. removed their assignment
    on Nov 18, 2016
  7. CIPop commented on Dec 8, 2016

    @CIPop
    Contributor

    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/ build -outerloop testing.

  8. JustArchi commented on Sep 26, 2017

    @JustArchi
    Contributor

    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.

  9. MikhailArkhipov commented on Oct 5, 2017

    @MikhailArkhipov

    We really need this to support R in VS Code. Many R users are on Win7

  10. wsnell commented on Nov 21, 2017

    @wsnell

    Desperately need

  11. TechnikEmpire commented on Nov 24, 2017

    @TechnikEmpire

    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.

  12. stephentoub commented on Nov 24, 2017

    @stephentoub
    MemberAuthor

    there are a bazillion pure managed implementations out there

    The implementation that's used here on Unix is managed, built on sockets.

  13. 19 remaining items

  14. wsnell commented on Dec 1, 2017

    @wsnell
  15. changed the title [-]Use managed WebSockets implementation on Windows 7?[/-] [+]Use managed WebSockets implementation on all Windows (not UWP)[/+] on Dec 8, 2017
  16. karelz commented on Dec 8, 2017

    @karelz
    Member

    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!)

    Both implementations (managed and WinHttp based) have the same feature gaps.
    The managed WebSocket implementation (currently used only on Linux) is missing HTTP auth and proxy support.
    The Windows .NET Core WebSockets implementation used on Windows 8+ (using WinHTTP) is also not using HTTP auth nor proxy settings.
    While it is easier to enable HTTP auth and proxy for the WinHTTP based implementation, it doesn’t help the managed implementation which is used on Linux. In addition, there is a desire to enable Windows 7 .NET Core support for WebSockets which would require the managed implementation as well.
    In terms of test support, it is equivalent. The assumption, though, is that any PRs enhancing the managed WebSockets implementation to add HTTP auth and proxy support would include tests.
    I have no problem getting rid of the WinHTTP based implementation for Windows WebSocket on .NET Core and converging on the managed implementation.
    For now, though, this work will not include the .NET Core UWP implementation of WebSockets which uses yet another different implementation (WinRT WebSockets).

  17. davidfowl commented on Dec 13, 2017

    @davidfowl
    Member

    😍 this is great news

  18. TechnikEmpire commented on Dec 22, 2017

    @TechnikEmpire

    @kasper3 lol feel free to submit a PR.

  19. qmfrederik commented on Dec 22, 2017

    @qmfrederik
    Contributor

    @kasper3 if you open the drtails for that package, you should see preview1 builds which are much more recent. You'll want those.

  20. qmfrederik commented on Dec 22, 2017

    @qmfrederik
    Contributor
  21. TechnikEmpire commented on Jan 18, 2018

    @TechnikEmpire

    @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.

  22. qmfrederik commented on Jan 18, 2018

    @qmfrederik
    Contributor

    @TechnikEmpire What I did was to clone the CoreFX repository, edit src\System.Net.WebSockets.Client\src\System.Net.WebSockets.Client.csproj so that the package always targets Linux (which means using the managed handler):

      <PropertyGroup>
        <ProjectGuid>{B8AD98AE-84C3-4313-B3F1-EE8BD5BFF69B}</ProjectGuid>
        <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
        <TargetsWindows>false</TargetsWindows>
        <TargetsUnix>true</TargetsUnix>
      </PropertyGroup>
    

    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.

  23. transferred this issue fromdotnet/corefxon Jan 31, 2020
  24. added this to the 2.1.0 milestone on Jan 31, 2020
  25. ghost locked as resolved and limited conversation to collaborators on Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-System.Netenhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions