Skip to content

Fish-Networking transport

Namespace: BlitzRelay.FishNet

Component: BlitzRelayTransport

Requires Unity 2022.3 or later and an existing Fish-Networking installation.

Field Default Purpose
Relay Address 127.0.0.1 Relay hostname or IP address.
Relay Port 7770 Relay UDP port.
Relay Key Empty Must match BLITZ_RELAY_CONNECTION_KEY.
Room Code Empty Room to join or claim; assigned automatically to a new host.
Do Not Route Off Sets LiteNetLib’s socket DontRoute option.
Maximum Clients 4096 Requested room client limit, constrained in the Inspector to 1–8192.

The transport uses an MTU override of 1,350 bytes. GetMTU() subtracts the LiteNetLib and largest relay headers before reporting the usable game payload size.

Member Meaning
GetRelayAddress() / SetRelayAddress(string) Read or replace the relay address.
GetRelayPort() / SetRelayPort(ushort) Read or replace the relay UDP port.
GetRoomCode() / SetRoomCode(string) Read the assigned code or select a room for a client.
GetRoomHostToken() / SetRoomHostToken(string) Read or replace the active room’s host token.
IsRelayHostAvailable Whether the room currently has an active relay host.
OnRelayHostAvailabilityChanged Raised when host availability changes.
ServerSocket / ClientSocket The transport’s relay sockets and states.
SetPacketLayer(PacketLayerBase) Applies a LiteNetLib packet layer after the affected sockets restart.

The relay key has no public runtime setter. Configure it in the Inspector or serialised prefab before starting a connection.

  • SetClientAddress() and GetClientAddress() operate on the relay address.
  • SetPort() updates the relay UDP port.
  • SetServerBindAddress() has no effect because game clients connect through the relay.
  • GetConnectionAddress(id) returns relay:{id} for an active virtual client.
  • Timeouts are expressed in seconds through Fish-Networking and converted to milliseconds for LiteNetLib.
  • Starting the client while the server is still starting is deferred until the server relay connection is ready.
Fish-Networking channel Relay delivery
0 Reliable ordered
1 Unreliable

Channel IDs outside Fish-Networking’s supported channel count are replaced with channel 0 and logged as a warning.

Promotion is automatic. The transport acknowledges the claim, stops its client connection, starts the server with the claim token, and then starts its local client after the room is claimed. See Handle host migration.