WebGL ArgumentException: IPC network driver can only handle loopback addresses

Allocation allocation = await AllocateRelay();NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(new RelayServerData(allocation, "dtls"));
NetworkManager.Singleton.StartHost();

Windows runs normally, but when switching to WebGL, an error occurs.

ArgumentException: IPC network driver can only handle loopback addresses
Unity.Networking.Transport.IPCNetworkInterface.CreateInterfaceEndPoint (Unity.Networking.Transport.NetworkEndPoint address, Unity.Networking.Transport.NetworkInterfaceEndPoint& endpoint) (at Library/PackageCache/com.unity.transport@1.3.1/Runtime/IPCNetworkInterface.cs:47)
Unity.Networking.Transport.Relay.RelayNetworkProtocol.Bind (Unity.Networking.Transport.INetworkInterface networkInterface, Unity.Networking.Transport.NetworkInterfaceEndPoint& localEndPoint) (at Library/PackageCache/com.unity.transport@1.3.1/Runtime/Relay/RelayNetworkProtocol.cs:237)
Unity.Networking.Transport.NetworkDriver.Bind (Unity.Networking.Transport.NetworkEndPoint endpoint) (at Library/PackageCache/com.unity.transport@1.3.1/Runtime/NetworkDriver.cs:988)
Unity.Netcode.Transports.UTP.UnityTransport.ServerBindAndListen (Unity.Networking.Transport.NetworkEndPoint endPoint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Transports/UTP/UnityTransport.cs:529)
Unity.Netcode.Transports.UTP.UnityTransport.StartRelayServer () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Transports/UTP/UnityTransport.cs:675)
Unity.Netcode.Transports.UTP.UnityTransport.StartServer () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Transports/UTP/UnityTransport.cs:1316)
Unity.Netcode.NetworkManager.StartHost () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1162)
KitchenGameMultiplayer.StartHost () (at Assets/Scripts/KitchenGameMultiplayer.cs:105)
KitchenGameLobby.CreateLobby (System.String lobbyName, System.Boolean isPrivate) (at Assets/Scripts/KitchenGameLobby.cs:289)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <28d694a2939e4826992577f826717d3b>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <28d694a2939e4826992577f826717d3b>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <28d694a2939e4826992577f826717d3b>:0)

What could be the cause of this issue and how can it be resolved?

You'll need to use "wss" instead of "dtls" as the connection type. You'll also need to make sure you install version 2.X of the com.unity.transport package (latest is 2.0.2) and check the "Use WebSockets" checkbox under the Unity Transport component in the inspector.

1 Like

Hey, thanks for that tip, however "use websockets" doesn't seem to be an option under the unity transport component

9230472--1289322--Screenshot 2023-08-17 at 3.25.26 PM.png

Do you have Unity Transport 2.X installed? For this option to appear, package com.unity.transport needs to be at least version 2.0 (latest is 2.0.2). Furthermore, this package version is only supported on Unity 2022.2 or later.

3 Likes