uriformatexception-in-webgl-when-running-self-hosted

Options
Hi,
I have recently been wanting to run a WebGl build inside my Unity project connecting to my self hosted server running a modified LoadBalancing app. I have the standard PUN Classic in my Unity project and am able to connect and run everything correctly when building for both mac and windows standalone, however as soon as I switch to WebGL I am getting this error:

System.UriFormatException: URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character.
at System.Uri.Parse (UriKind kind, System.String uriString) [0x00000] in :0
at System.Uri.ParseUri (UriKind kind) [0x00000] in :0
at System.Uri..ctor (System.String uriString, Boolean dontEscape) [0x00000] in :0
at System.Uri..ctor (System.String uriString) [0x00000] in :0
at ExitGames.Client.Photon.SocketWebTcp.Connect () [0x00060] in /Users/LeonP-S/Documents/RedShiftHD/RedShift/Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs:104
at ExitGames.Client.Photon.TPeer.Connect (System.String serverAddress, System.String appID, System.Object customData) [0x00000] in :0
at ExitGames.Client.Photon.PhotonPeer.Connect (System.String serverAddress, System.String applicationName, System.Object custom) [0x00000] in :0
at ExitGames.Client.Photon.NetworkingPeer.Connect (System.String serverAddress, ServerConnection type) [0x00078] in /Users/LeonP-S/Documents/RedShiftHD/RedShift/Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:672
at ExitGames.Client.Photon.PhotonNetwork.ConnectUsingSettings (System.String gameVersion) [0x001a0] in /Users/LeonP-S/Documents/RedShiftHD/RedShift/Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1265
at ServerConnectionUtility.ConnectToServer (System.String gsUserID, System.String gsToken) [0x0003a] in /Users/LeonP-S/Documents/RedShiftHD/RedShift/Assets/Scripts/Server/ServerConnectionUtility.cs:19

It then seems to remain at the PeerCreated state, sorry if this would be better suited to the PUN section of the forum however i wasn't sure where it would be best placed. The title of the thread is a copy of someones from a while back however that was from 2015 and there was no solution that was of any help.

Thanks for any help.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2019
    Options
    Hi @LeonPS,

    Thank you for choosing Photon!

    WSS protocol is used with WebGL.
    The server address string must start with "wss://".
    Make sure to follow the guide here.
  • LeonPS
    Options
    Thanks for pointing this out, I really didn't notice it. Okay so I have done a basic configuration of this, I am able to connect to my master server fine however as soon as I try to create/connect to a game I am getting ConnectingToGameserver and it won't continue, is there anything obvious that could be causing this, I am currently just using ws:// .
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @LeonPS,

    You probably have an issue with the configuration of the Game Server.
    Double check the port number and go through the guide one more time.
    We recommend WebSocketsSecure.
    Search the forum for hints, example.