Enabling WebSockets for Desktop target

Options
I do a bunch of my development at random coffee shops and other places with public wifi. They mostly all have one thing in common: they block UDP.

But while on these connections, when I switch the deployment to HTML5 (which forces WebSockets) it works just fine.
But I'm not trying to build an embedded game. But it shows me that WebSockets work.

When I switch back to desktop dpeloyment and switch the connection type to WebSockets, i'm presented several errors of an unimplemented connection type.

Googling around hasn't surfaced anything usable, and anything that is relevant is just someone saying "you need to make sure the class file is in a certain folder" but not being any clearer over what kind of file this is? is it prepacked with PUN? Do I have to write it myself? is it a separate download somewhere?

I'm connecting to Photon Cloud.

What should I do?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @RedactedProfile,

    Thank you for choosing Photon!

    I think this is maybe due to the fact that most of WebSockets code if not all is wrapped under #if UNITY_WEBGL.
    So I would start looking at the PUN code inside #if UNITY_WEBGL or set the platform to WebGL.

    The intended and main purpose of WebSocket in PUN, is to be used with WebGL.
    However, in theory, it can be used on the standalone platform and on the Editor. The required files are there "Assets/Photon/PhotonLibs/WebSocket".
  • DavidSWu
    Options
    Have you tried TCP? We fall back to TCP when UDP fails. It is not ideal but it helps in many cases.
    I don't know how WebSockets compare to TCP. But they sound kind of scary to me.
    I try to avoid anything with the word "Web" in it when developing games.

    Hope that helps!