Table of Contents

Interface INetworkManagerWrapper

Namespace
FishMMO.Server.Implementation
Assembly
FishMMO.Server.dll

Interface for network-related operations, decoupling the Server class from the concrete FishNet implementation.

public interface INetworkManagerWrapper

Properties

NetworkManager

Gets the underlying FishNet NetworkManager instance.

NetworkManager NetworkManager { get; }

Property Value

NetworkManager

Methods

ApplyTransportConfiguration(string, ushort?)

Applies transport configuration values from IServerConfiguration.

void ApplyTransportConfiguration(string addressOverride = null, ushort? portOverride = null)

Parameters

addressOverride string
portOverride ushort?

AttachLoginAuthenticator(IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour>)

Attaches a login authenticator using the provided Server.

void AttachLoginAuthenticator(IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour> server)

Parameters

server IServer<INetworkManagerWrapper, NetworkConnection, IServerBehaviour>

The server instance.

BroadcastToScene<T>(Scene, T, bool, Channel)

Broadcasts one message to every connection FishNet has in a scene, serialising it once.

bool BroadcastToScene<T>(Scene scene, T broadcast, bool requireAuthentication = true, Channel channel = Channel.Reliable) where T : struct, IBroadcast

Parameters

scene Scene

The scene whose connections receive the message.

broadcast T

The message to broadcast.

requireAuthentication bool

Whether each recipient must be authenticated.

channel Channel

The channel to use for broadcasting (default is Reliable).

Returns

bool

True if the scene had at least one connection.

Type Parameters

T

The broadcast type.

Remarks

Reads SceneManager.SceneConnections, which FishNet keeps per loaded scene, so no caller needs to walk the server's characters asking each for its scene.

Broadcast<T>(NetworkConnection, T, bool, Channel)

Broadcasts a message to a single network connection.

void Broadcast<T>(NetworkConnection conn, T broadcast, bool requireAuthentication = true, Channel channel = Channel.Reliable) where T : struct, IBroadcast

Parameters

conn NetworkConnection

The network connection to send the message to.

broadcast T

The message to broadcast.

requireAuthentication bool
channel Channel

The channel to use for broadcasting (default is Reliable).

Type Parameters

T

The broadcast type.

Broadcast<T>(HashSet<NetworkConnection>, T, bool, Channel)

Broadcasts one message to every connection in a set, serialising it once.

void Broadcast<T>(HashSet<NetworkConnection> connections, T broadcast, bool requireAuthentication = true, Channel channel = Channel.Reliable) where T : struct, IBroadcast

Parameters

connections HashSet<NetworkConnection>

The recipients.

broadcast T

The message to broadcast.

requireAuthentication bool

Whether each recipient must be authenticated.

channel Channel

The channel to use for broadcasting (default is Reliable).

Type Parameters

T

The broadcast type.

Remarks

The single-connection overload serialises per call, so a loop over it pays the serialisation once per recipient. Use this for any fan-out: a scene's connections, a match's team, a party's local members. The set is read, never kept; an empty or null set is a no-op.

RegisterBroadcast<T>(Action<NetworkConnection, T, Channel>, bool)

Registers a broadcast handler for the given type.

void RegisterBroadcast<T>(Action<NetworkConnection, T, Channel> handler, bool requireAuthentication = true) where T : struct, IBroadcast

Parameters

handler Action<NetworkConnection, T, Channel>

The handler to register.

requireAuthentication bool

Whether authentication is required for the broadcast.

Type Parameters

T

The broadcast type.

RegisterServerConnectionStateEventHandler(Action<ServerConnectionStateArgs>)

Subscribes to server connection state changes.

void RegisterServerConnectionStateEventHandler(Action<ServerConnectionStateArgs> handler)

Parameters

handler Action<ServerConnectionStateArgs>

The handler to invoke on connection state changes.

SetMaximumClients(int)

Sets the maximum number of clients manually.

void SetMaximumClients(int clients)

Parameters

clients int

The maximum number of clients allowed.

SetTransportAddress(string, IPAddressType)

Sets the transport bind address manually.

void SetTransportAddress(string address, IPAddressType addressType)

Parameters

address string

The address to bind the transport to.

addressType IPAddressType

The type of IP address (IPv4 or IPv6).

SetTransportPort(ushort)

Sets the transport port manually.

void SetTransportPort(ushort port)

Parameters

port ushort

The port number to use for the transport.

StartServer()

Starts the server.

void StartServer()

StopServer()

Stops the server.

void StopServer()

TryGetSceneConnections(Scene, out HashSet<NetworkConnection>)

Gets FishNet's live connection set for a scene. The set belongs to FishNet: read it on the main thread and never modify or keep it.

bool TryGetSceneConnections(Scene scene, out HashSet<NetworkConnection> connections)

Parameters

scene Scene

The scene.

connections HashSet<NetworkConnection>

The scene's connections, or null.

Returns

bool

True if the scene has at least one connection.

UnregisterBroadcast<T>(Action<NetworkConnection, T, Channel>)

Unregisters a broadcast handler for the given type.

void UnregisterBroadcast<T>(Action<NetworkConnection, T, Channel> handler) where T : struct, IBroadcast

Parameters

handler Action<NetworkConnection, T, Channel>

The handler to unregister.

Type Parameters

T

The broadcast type.

UnregisterServerConnectionStateEventHandler(Action<ServerConnectionStateArgs>)

Unsubscribes from server connection state changes.

void UnregisterServerConnectionStateEventHandler(Action<ServerConnectionStateArgs> handler)

Parameters

handler Action<ServerConnectionStateArgs>

The handler to remove from connection state changes.