Unity WebGL build with Photon Server

Hello!
We have our game, that works on mobile platforms, and communicates with Photon Servers, that are hosted on different remote machines.
Now, we decided to make WebGL version of our game, however, we have met following problem:
WebGL build does not work with UDP, and expects WS/WSS.
How can we achieve that with our current setup?
Should we rewrite our servers? Or is there any adapter we might use for our servers to work with both webgl/mobile apps?

We use SDK_v4-0-29-11263 for server, it is just modified LoadBalancing app, that communicates with client through RPC, Operation Request/Response.

Many thanks, hope we will get some help here!

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @pavelbaslak,

    You don't need to rewrite your servers.
    You need to add a listener for WSS and configure the server properly.
    Follow this guide here.
  • Hello @JohnTube
    I did exactly the same, but still cant connect to my server with wss. I even enabled 9091, 9090 port in firewall

    Below are my settings. I cant connect to my server, even throug web websockets checker sites
    https://imgur.com/a/cUP9BqR
    https://imgur.com/a/zp7m7TX
    https://imgur.com/a/OJD83GP
    https://imgur.com/a/8QtxGEh

    What could be wrong?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @pavelbaslak,

    Could you provide:
    • PUN version
    • Unity version
    • Client logs (text or screenshot of Unity Editor console with error(s))
    • Server logs (send us all log files, paths can be found here)
    Notes:
    You don't need the AppId when self-hosting.
  • pavelbaslak
    edited February 2019
    @JohnTube

    1) 1.80
    2) Unity 2018.1.9f2 (64-bit)
    3) nothing in unity, for a while, after that it sends that https://imgur.com/a/NL2xCn9
    4) https://we.tl/t-3pM5lVDUge
    5) https://imgur.com/a/zbuRL40 - this is log from firefox console
  • Actually @JohnTube
    3) 2nd error is when we connect to server, and 3rd when creating the room https://imgur.com/a/wKtcrmi
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @pavelbaslak,

    You did not send the Master and GameServer applications logs.

    You are using the same code with other protocol and from other platforms and it just works?

    It looks like the client managed to connect to the server but something else is wrong.
    apps logs will tell us more.
  • @JohnTube
    Hello,
    sorry for late response.
    Yea, while the game works with regular UDP, we cant connect to it via web socket
    here is all files we modified

    https://we.tl/t-RHbG18LYXa
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Hi @pavelbaslak,

    The Game Server log is full of:
    Exception: System.NullReferenceException: Object reference not set to an instance of an object.
    at Photon.LoadBalancing.GameServer.Game.get_GameVersion() in C:\Users\root\Documents\FA-Server\src-server\Loadbalancing\LoadBalancing\GameServer\Game.cs:line 605


    You need to fix those first as they are all over the place.

    Does this happen with UDP as well? (you can delete the logs or back them up and try again to see if the exception occurs with UDP clients also)
    Did you modify server code as Photon Server should not support AppId and AppVersion in the first place.
    Do you use custom plugins? You did not provide "Photon.LoadBalancing.dll.config" for GS you probably copy/pasted the wrong file "PhotonServer.config". Anyway just checking.

    @chvetsov if you have time, you can help me with the logs, you're better than me for this.
  • @JohnTube
    Here are master and game server settings:
    https://we.tl/t-Xm01V6fUXp

    I also tried clean setup, and now I see this in chrome console https://we.tl/t-ioXQXK1aD5

    The exception you mentioned is related to some unsecure custom code we have. it probably happens when test client is being called. Normal game should opperate with it.

    We use LoadBalancing as base for our app, and operate with modified code of it. We mostly work with Game.cs and GameClientPeer.cs classes.

    No custom plugins are used.


  • JohnTube
    JohnTube ✭✭✭✭✭
    We will continue via email