Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Solved] ClientWebSocket WSS issues

Discussion in '2018.1 Beta' started by xortrox, Apr 26, 2018.

  1. xortrox

    xortrox

    Joined:
    Feb 13, 2011
    Posts:
    22
    I'm posting this in hopes of bringing more light to the problem I've been having with web sockets in Unity 2018.1 beta

    I'd mainly like to know if this is planned for being fixed any time soon, or if I'm gonna have to look for alternatives in terms of making my player connections secure.

    Before I begin I'd like to point out that HTTPS requests to the same server already work, it's just the websocket WSS scheme that doesn't seem to be able to connect.

    The error i've mostly been seeing while debugging is "1002" which is an "Protocol Error" message. I believe this is simply because it can't perform the SSL handshake properly.

    So I've got a project using .Net 4.6 where I've tried to connect with the .Net 4.5 ClientWebSocket to a secure scheme at:
    wss://mydomain.com

    This simply does not work in unity as of now.

    If I use this test tool to connect to my domain it works fine:
    https://websocket.org/echo.html

    If I use an entirely separate standalone console application made with .Net 4.6 it also works fine to connect to my domain using ClientWebSocket with WSS

    Other implementations like WebSocketSharp also seem to not be working.

    A lot of solutions mentioned around the forums have not worked as they seem to be outdated when it comes to websockets, things like "allowing all certificates" (which is also a security risk) also do not work.

    From my standpoint it would seem like it's just a matter of unity implementing the known certificate authorities for websockets as they have for HTTPS already.

    I posted this as a bug about a month back:
    https://fogbugz.unity3d.com/default.asp?1016393_vhg86kfmphme5hm0
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Unfortunately, HTTPS won't work with Unity 2018.1. We've fixed that in 2018.2 though. Can you try the latest 2018.2 beta with this same code?
     
    xortrox and andreasreich like this.
  3. xortrox

    xortrox

    Joined:
    Feb 13, 2011
    Posts:
    22
    Latest 2018.2 beta actually solved this issue for me, thanks for the help!
     
    JoshPeterson likes this.
  4. xortrox

    xortrox

    Joined:
    Feb 13, 2011
    Posts:
    22
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Yes, I'll resolve it.
     
    xortrox likes this.