How to connect to photon with a webGL game?

Options
I have a webgl game, I embedded it into my website and the game worked until I got to the point where I had to connect to photon server.

My question is: Is there any specific ways I have to connect to photon with a webgl game?
(I am using Web Sockets Secure in my photon settings)

Answers

  • chvetsov
    Options
    Hi, @Argentum_Manus

    What client sdk are you using? What server sdk are you using?

    best,
    ilya
  • I was using unity webGL
  • chvetsov
    Options
    @Argentum_Manus
    what server sdk are you using self hosted or you try connect to cloud?
    if you are using self hosted try connect to cloud first.

    what type of websocket connection are you establishing? Secure or insecure? Secure are not supported out of the box by self hosted version. You need to install certificates and update configuration.

    best,
    ilya
  • I am connecting to the cloud with Unity Pun Free, and I am using a Secure websocket connection
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Argentum_Manus,

    Thank you for choosing Photon!

    PUN works out-of-the-box with Photon Cloud using WSS (WebSocketsSecure).

    I embedded it into my website and the game worked until I got to the point where I had to connect to photon server.
    What do you mean by this? What errors do you see? Does your game work from Unity Editor first?

    What Unity version and what PUN version are you using?
    Try out demos using WSS from Unity Editor in a fresh project and from a build and tell us if it works or not.
  • Argentum_Manus
    edited September 2018
    Options
    I am using the newest version of PUN and the game fully works with windows standalone and inside the editor. And I am using unity 2018.1.

    As far as errors go, I don't see any, the game just doesn't connect to photon.

    (I will reply later if the demos work when exported)
  • Suraj
    Options
    hi, @chvetsov mod
    can you please tell me how to create self - hosted server for webGL games using photon.
    1) I'm using Unity engine 2019 version
    2) photon pun 2 free version
  • chvetsov
    Options
    hi, @Suraj

    there is not too much to say.

    first setup and get it working with tcp or udp, than we non secure web sockets
    and than with secure

    using this page you can find information about certificate setup https://doc.photonengine.com/en-us/server/current/operations/certificate-setup

    One important note is that bin_Win64/PhotonServer.config contains bug. Urls like `Url="/*" ` should be replaced by `Url="/+"`


    best,
    ilya