Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
429 stars 161 forks source link

[WebGL build] Client connection event is not firing and client is disconnecting immediately #145

Open rohanrhu opened 2 years ago

rohanrhu commented 2 years ago

Hi, on web export, client connected event is not firing and client is disconnecting immediately (disconnected event is being called)

My plyer object's Start() method:


void Start() {
    print("Player.Start()");

    multiplayerManager = GameObject.Find("MultiplayerManager").GetComponent<MultiplayerManager>();

    if (IsOwnedByServer) {
        clients = new ArrayList();
        waiters = new ArrayList();

        NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
        NetworkManager.Singleton.OnClientDisconnectCallback += OnClientDisconnected;
        NetworkManager.Singleton.OnServerStarted += OnServerStarted;
    }

    if (NetworkManager.Singleton.IsServer) {
        return;
    }

    if (IsOwner) {
        HelloServerRpc();
        JoinGameServerRpc();
    }
}

Please let's fix these bugs :(

rohanrhu commented 2 years ago

Unity and this things are totally broken and buggy.

LukeStampfli commented 2 years ago

Which transport are you using and could you provide some more informations and steps to reproduce this?

rohanrhu commented 2 years ago

Which transport are you using and could you provide some more informations and steps to reproduce this?

WebSocket

saqibkhan2523 commented 1 year ago

I am facing the same issue but with Unity Transport.