WebGL - Invalid URI: The URI scheme is not valid

Hello, I have installed the server and the server works fine for PC mode but WebGL throws the error when I run the game (all locally); Invalid URI: The URI scheme is not valid.

It works when I have it set to point at the photon server but not locally. Any thoughts?
UriFormatException: Invalid URI: The URI scheme is not valid.
System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) (at <ef151b6abb5d474cb2c1cb8906a8b5a4>:0)
System.Uri..ctor (System.String uriString) (at <ef151b6abb5d474cb2c1cb8906a8b5a4>:0)
ExitGames.Client.Photon.SocketWebTcp.Connect () (at Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs:111)
ExitGames.Client.Photon.TPeer.Connect (System.String serverAddress, System.String proxyServerAddress, System.String appID, System.Object customData) (at <0c939868ea3845a686c05b5dcd9bf480>:0)
ExitGames.Client.Photon.PhotonPeer.Connect (System.String serverAddress, System.String proxyServerAddress, System.String appId, System.Object custom) (at <0c939868ea3845a686c05b5dcd9bf480>:0)
Photon.Realtime.LoadBalancingClient.ConnectToMasterServer () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:935)
Photon.Pun.PhotonNetwork.ConnectToMaster (System.String masterServerAddress, System.Int32 port, System.String appID) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1225)
Photon.Pun.PhotonNetwork.ConnectUsingSettings (Photon.Realtime.AppSettings appSettings, System.Boolean startInOfflineMode) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1155)
Photon.Pun.PhotonNetwork.ConnectUsingSettings () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1092)

Comments

  • hi, @welfarecheck

    how do you set your url?
    how did you setup server side?

    best,
    ilya
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @welfarecheck,

    Thank you for choosing Photon!

    Maybe for WebGL you need to explicitly set "ws://" or "wss://" scheme prefix in server address?
  • I also facing this issue. I literally have no idea what to do in server.
    I added ws:// and got this
    Exiting receive thread. Server: ws://45.76.239.133:5055:0 Error: An exception has occurred while connecting.
    UnityEngine.Debug:LogError(Object)
    Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2480)
    ExitGames.Client.Photon.<ReceiveLoop>d__12:MoveNext() (at Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs:297)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    I have server and game. I planning to pay someone to do this. What should exactly say to him ?
    Just show this (this guide for v4) https://doc.photonengine.com/en-us/server/current/operations/websockets-ssl-setup and ask to do this on my Server ?
    My Photon Server SDK version is v5
    Unity 2020.1.11f
  • sulokutty
    sulokutty
    edited March 2021
    Spent hours. No luck. I give up :'(

    Edit : Server SDK v5 download link is broken
  • hi, @sulokutty
    >Exiting receive thread. Server: ws://45.76.239.133:5055:0
    do you see that your address is broken at all? It is broken in two ways. first it contains port twice: 5055 and 0. and second 5055 is UDP port WS will never able to connect there

    @JohnTube could you take over and check if everything right on client side?

    best,
    ilya
  • chvetsov wrote: »
    hi, @sulokutty
    >Exiting receive thread. Server: ws://45.76.239.133:5055:0
    do you see that your address is broken at all? It is broken in two ways. first it contains port twice: 5055 and 0. and second 5055 is UDP port WS will never able to connect there

    @JohnTube could you take over and check if everything right on client side?

    best,
    ilya

    Well, I gave up already. Using PUN Cloud. Still faced a problem. Will post on correct section
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @sulokutty,

    Thank you for choosing Photon!

    What are your PhotonServerSettings? a screenshot will do after removing the server address.
    What PUN version are you using?
    What Unity version are you using?
    Do you use WebGL or explicitly switch to WSS as a transport protocol from PhotonServerSettings?

    In theory if you use WebGL you should just set the server address without prefix "wss://" and without port and it will just work.

    Thank you for reporting the broken Photon Server v5 SDK download link, we will fix it.
  • JohnTube wrote: »
    Hi @sulokutty,

    Thank you for choosing Photon!

    What are your PhotonServerSettings? a screenshot will do after removing the server address.
    What PUN version are you using?
    What Unity version are you using?
    Do you use WebGL or explicitly switch to WSS as a transport protocol from PhotonServerSettings?

    In theory if you use WebGL you should just set the server address without prefix "wss://" and without port and it will just work.

    Thank you for reporting the broken Photon Server v5 SDK download link, we will fix it.
    I will try everything again from beginning and see. Then, update the thread
  • sulokutty
    sulokutty
    edited March 2021
    Looks like I need v5 SDK fresh zip file to continue. I don't have it. and download link is still broken
    Download link working under PLUGINS. not under Server button
  • Sorry, wasn't watching this thread for some reason. :/

    Started using windows/android build and that works fine. The WebGL error is specific to the local install for the server. Cloud works fine. I have tried all the protocols to make sure I wasn't missing anything but I'm pretty limited in my knowledge at this point about what to look for.

    I created a new project in Unity 2018, 2019, and 2021 with PUN 2.27 and server 4.0.28.2962.

    I see there is a V5 beta on the site but the link is broke. I will happily test that out if it might help. I downloaded V3 but there is no way to generate a license on the site from what I can tell and it says not authorized when I test the load balancer.

  • I'm having a similar problem in a WebGL environment.

    It is a v5 environment of Unity2021, PUN2.40 and Photon Server.

    Even if you do not enter the port, the ": 0" port number is added at the end, so an error occurs and you cannot connect.

    Can you solve this problem?

    Exiting receive thread. Server: wss://192.168.68.62:19093:0 Error: An exception has occurred while connecting.

  • @Tobias could you take a look


    best,

    ilya

  • As far as I know, the :0 at the end, is just there in the log, not the host address used to connect to.

    For WSS you need to setup a certificate (on the server). Is that done?