Skip to content

A Distributed Authority session created by a WebGL build cannot be joined by any peer #4111

Description

@byteflowx

Description

The WebGL host itself is fine: ISession.State == Connected, ISession.Network.State == Started,
NetworkManager.IsListening == true, and it is correctly a client of the CMB service
(isServer=False, isClient=True, UseCMBService=True).

The joining peer opens the relay WebSocket and exchanges frames in both
directions once per second for the whole attempt, but NetworkManager.IsConnectedClient never
becomes true. After MaxConnectAttempts NGO shuts the client down and the SDK reports
SessionError.NetworkManagerStartFailed.

The same WebGL build joins an Editor-hosted session without any problem, and the same code works
in Multiplayer Play Mode. Only sessions hosted by a WebGL build refuse peers.

Reproduce Steps

  1. Configure per Distributed authority and WebGL quickstart: DistributedAuthorityTransport on the
    NetworkManager, Use Web Sockets enabled.
  2. Host:
var options = new SessionOptions { MaxPlayers = 4 }
    .WithDistributedAuthorityNetwork()
    .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.WSS });

ISession session = await MultiplayerService.Instance.CreateSessionAsync(options);
  1. Build for WebGL (release), open in localhost browser A, create the session, note session.Code.
  2. Open the same build in localhost browser B.
  3. Join from B:
var joinOptions = new JoinSessionOptions()
    .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.WSS });

ISession session = await MultiplayerService.Instance.JoinSessionByCodeAsync(code, joinOptions);
// never returns

Same result with JoinSessionByIdAsync and MatchmakeSessionAsync(QuickJoinOptions, SessionOptions).

Actual Outcome

JoinSessionByCodeAsync never returns. The lobby join itself succeeds — a second attempt from the
same client returns SessionException: player is already a member of the lobby.

Joining client:

Unity Transport: Connecting to wss://4296532389410631913.us-central1.relay.uf.unity3d.com:37011/. no Netcode connection
[Multiplayer]: GameObjectsNetcodeNetworkHandler.StopAsync: Failed to stop session: session was never started.
AddingSessionFailed — NetworkManagerStartFailed: Failed to start the network manager

Expected Outcome

The peer connects and JoinSessionByCodeAsync returns a session with IsConnectedClient == true,
as it does when the host is the Editor.

Environment

  • OS: macOS
  • Unity Version: 6000.5.4f1
  • Netcode Version: 2.13.1, com.unity.services.multiplayer 2.2.4, com.unity.transport 6.5.0
  • Netcode Topology: Distributed Authority
  • Unitask: 2.5.11

Additional Context

| SessionOwner | client | Result |

| Editor | Editor (Multiplayer Play Mode) | works |
| Editor | WebGL build | works |
| WebGL build | Editor | fails |
| WebGL build | WebGL build | fails |

Metadata

Metadata

Assignees

No one assigned

    Labels

    stat:awaiting-triageStatus - Awaiting triage from the Netcode team.stat:reply-neededAwaiting reply from Unity accounttype:bugBug Report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions