WebGL Websocket never passes connecting status

Options
I cannot seem to get WebGL Secure WebSockets to work with my self-hosted server.

To recreate this I created a new Unity project with the PUN2 package loaded. I also created the following script to connect to my Photon Server.
using Photon.Pun;
using ExitGames.Client.Photon;
using UnityEngine;

public class Test : MonoBehaviour, IPhotonPeerListener
{
    public void DebugReturn(DebugLevel level, string message)
    {
        Debug.Log($"DEBUG: {message}");
    }

    public void OnEvent(EventData eventData)
    {
        Debug.Log("OnEvent");
    }

    public void OnOperationResponse(OperationResponse operationResponse)
    {
        Debug.Log("OnOperationResponse");
    }

    public void OnStatusChanged(StatusCode statusCode)
    {
        Debug.Log("OnStatusChanged");
    }

    void Start()
    {
        PhotonNetwork.ConnectUsingSettings();
    }

    void OnGUI()
    {
        GUI.Label(new Rect(10, 40, 200, 40), $"IsConnected: {PhotonNetwork.IsConnected}");
        GUI.Label(new Rect(10, 80, 200, 40), $"IsConnectedAndReady: {PhotonNetwork.IsConnectedAndReady}");
    }
}
Photon Server Settings:


However all I ever get is a status of connecting..


In a packet capture I see a connection is actually established and the server seems to be okay with my SSL certificate but closes the connection shortly after.


Here is my Photon server config


The Photon server code is your typical CreatePeer override. It works fine with tcp, just not WebSockets..

Does anyone have any idea what I'm doing wrong here?

Comments

  • Delmus
    Options
    I believe I may have solved this myself..

    I changed the following in SocketWebTcp.cs and was able to get the connection to stay open and even send operations.

    public static string SerializationProtocol = "GpBinaryV18";
    To
    public static string SerializationProtocol = "GpBinaryV16";

    Does anyone know if this is just caused by incompatibility between newer PUN and Photon Server or if it's something with my setup?
  • Hi @Delmus,

    glad you already found a solution for the problem.

    The OnPremiseSDK currently doesn't support the latest serialization protocol, so you have to use an older one. I sadly can't give you any ETA about the new OnPremiseSDK which will support the latest serialization protocol, too.

    One question: which PUN 2 version do you currently use? We have already added a fix for this issue in version 2.0.1. However this fix only applies, when using PhotonNetwork.ConnectUsingSettings. Do you use this function to connect to your server or do you use PhotonNetwork.ConnectToMaster?
  • Delmus
    Options
    I'm using PUN2 v2.3 and PhotonNetwork.ConnectUsingSettings. In the latest PUN2 package I still see the serialization protocol hard coded.
  • As long as the OnPremiseSDK does not support the latest serialization protocol, this is a workaround, so that PUN 2 clients can connect to self-hosted server by using an older serialization protocol. Or do you mean something else?