Connecting with websocket and building WebGL

Hi, I'm trying to get work Unity3D with websocket.
I've tried 2 dlls - Photon3Net.dll and Photon3Unity3D.dll.

If I try to connect with websockets with Photon3DotNet.dll it works fine in editor, but when I try to run project with WebGL it gets stuck on
MissingMethodException: No constructor found for ExitGames.Client.Photon.SocketWebTcp::.ctor(ExitGames.Client.Photon.TPeer)
, so I guess I need, the second dll, because of this support (or not?). But, when I try the second Unity3D.dll, then It does nothing. I don't get any error.

So my question is - Does anybody know how to get websockets working with unity WebGL?


  • You're posting in the DotNet category, which suggest you're not using PUN?
    Which SDK version are you using?

    Part of the problem is, that Unity didn't include a websocket implementation in the build. This may be code stripping or it might be due to incomplete setup.

    We need to know your SDK and version to help.
  • I'm using the newest version -
    I found the websocket folder in unity's SDK and I did everything from Readme-Photon-WebSocket.txt.
    I'm getting System Exception: Thread creation failed now.
    I'm stuck with this about 3 hours, maybe I'm missing something..?
  • Thread creation is impossible in WebGL/JS. Does your code try to use a Thread?
    Do you get a callstack for that?

  • I'm trying this with new unity project - I made script, that contains only connection.
    It works in editor, windows build but when I try to run it in WebGL, it just throws this exception, without any callstack (callstack is lost in IL2CPP).
  • Hi @Twinity,

    Thank you for choosing Photon!

    In your project, make sure to have a "WebSocket" or "PhotonWebSocket" folder under "Assets/Plugins".
    It should be inside the "PhotonAssets" folder of the SDK.

    Also, make sure to set WSS as the transport protocol before connecting:

    either pass it to the constructor of the class that extends LoadBalancingClient or

    this.TransportProtocol = ConnectionProtocol.WebSocketSecure;
Sign In or Register to comment.