Adds relay, punchthrough, and port-forwarding support to the Mirror NetworkServer More...
Static Public Member Functions | |
static void | InitializeHosting (int listenPort, GeographicRegion region=GeographicRegion.AUTO, Action< string, ushort > onPrepared=null, Action< string > onFatalError=null, bool forceRelayOnly=false) |
Initialize the server using NobleConnectSettings. The region used is determined by the Relay Server Address in the NobleConnectSettings. More... | |
static void | InitializeHosting (int listenPort, string relayServerAddress, Action< string, ushort > onPrepared=null, Action< string > onFatalError=null, bool forceRelayOnly=false) |
Initialize the client using NobleConnectSettings but connect to specific relay server address. This method is useful for selecting the region to connect to at run time when starting the client. More... | |
static void | Update () |
If you are using the NetworkServer directly you must call this method every frame. More... | |
static void | Listen (int port=0, GeographicRegion region=GeographicRegion.AUTO, Action< string, ushort > onPrepared=null, Action< string > onFatalError=null, bool forceRelayOnly=false) |
Start listening for incoming connections More... | |
static void | SetListenPort (ushort port) |
static ushort | GetTransportPort () |
static void | SetTransportPort (ushort port) |
static void | UnregisterHandler< T > () |
static void | ClearHandlers () |
static void | Dispose () |
Clean up and free resources. Called automatically when garbage collected. More... | |
static void | OnServerConnect (NetworkConnection conn) |
static void | OnServerDisconnect (NetworkConnection conn) |
Called on the server when a client disconnects More... | |
static void | Shutdown () |
static void | SendToAll< T > (T msg, int channelId=Channels.DefaultReliable, bool sendToReadyOnly=false) |
static void | SendToReady< T > (NetworkIdentity identity, T msg, bool includeSelf=true, int channelId=Channels.DefaultReliable) |
static void | SendToReady< T > (NetworkIdentity identity, T msg, int channelId=Channels.DefaultReliable) |
static void | DisconnectAll () |
static void | SendToClientOfPlayer< T > (NetworkIdentity player, T msg) |
static bool | ReplacePlayerForConnection (NetworkConnection conn, GameObject player, Guid assetId, bool keepAuthority=false) |
static bool | ReplacePlayerForConnection (NetworkConnection conn, GameObject player, bool keepAuthority=false) |
static bool | AddPlayerForConnection (NetworkConnection conn, GameObject player, Guid assetId) |
static bool | AddPlayerForConnection (NetworkConnection conn, GameObject player) |
static void | SetClientReady (NetworkConnection conn) |
static void | SetAllClientsNotReady () |
static void | SetClientNotReady (NetworkConnection conn) |
static void | DestroyPlayerForConnection (NetworkConnection conn) |
static void | Spawn (GameObject obj) |
static void | Spawn (GameObject obj, GameObject player) |
static void | Spawn (GameObject obj, NetworkConnection conn) |
static void | Spawn (GameObject obj, Guid assetId, NetworkConnection conn) |
static void | Spawn (GameObject obj, Guid assetId) |
static void | Destroy (GameObject obj) |
static void | UnSpawn (GameObject obj) |
static NetworkIdentity | FindLocalObject (uint netId) |
static bool | SpawnObjects () |
Static Public Attributes | |
static float | allocationResendTimeout = .1f |
Initial timeout before resending refresh messages. This is doubled for each failed resend. More... | |
static float | requestTimeout = .2f |
Request timeout. More... | |
static int | maxAllocationResends = 8 |
Max number of times to try and resend refresh messages before giving up and shutting down the relay connection. More... | |
static int | relayLifetime = 60 |
How long a relay will stay alive without being refreshed (in seconds) More... | |
static int | relayRefreshTime = 30 |
How often to refresh the relay to keep it alive, in seconds More... | |
Properties | |
static IPEndPoint | HostEndPoint [get, set] |
This is the address that clients should connect to. It is assigned by the relay server. More... | |
static NetworkConnection | localConnection [get] |
static Dictionary< int, NetworkConnectionToClient > | connections [get] |
static bool | dontListen [get, set] |
static bool | active [get] |
static bool | localClientActive [get] |
Adds relay, punchthrough, and port-forwarding support to the Mirror NetworkServer
Use the Listen method to start listening for incoming connections.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Clean up and free resources. Called automatically when garbage collected.
You shouldn't need to call this directly. It will be called automatically when an unused NobleServer is garbage collected or when shutting down the application.
disposing |
|
static |
|
static |
|
static |
Initialize the server using NobleConnectSettings. The region used is determined by the Relay Server Address in the NobleConnectSettings.
topo | The HostTopology to use for the NetworkClient. Must be the same on host and client. |
onFatalError | A method to call if something goes horribly wrong. |
|
static |
Initialize the client using NobleConnectSettings but connect to specific relay server address. This method is useful for selecting the region to connect to at run time when starting the client.
relayServerAddress | The url or ip of the relay server to connect to |
topo | The HostTopology to use for the NetworkClient. Must be the same on host and client. |
onPrepared | A method to call when the host has received their HostEndPoint from the relay server. |
onFatalError | A method to call if something goes horribly wrong. |
|
static |
Start listening for incoming connections
maxPlayers | The maximum number of players |
port | The port to listen on. Defaults to 0 which will use a random port |
onPrepared | A method to call when the host has received their HostEndPoint from the relay server. |
|
static |
|
static |
Called on the server when a client disconnects
Some memory and ports are freed here.
message |
|
static |
|
static |
|
static |
T | : | struct | |
T | : | NetworkMessage |
|
static |
T | : | struct | |
T | : | NetworkMessage |
|
static |
T | : | struct | |
T | : | NetworkMessage |
|
static |
T | : | struct | |
T | : | NetworkMessage |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
T | : | struct | |
T | : | NetworkMessage |
|
static |
|
static |
If you are using the NetworkServer directly you must call this method every frame.
The NobleNetworkManager and NobleNetworkLobbyManager handle this for you but you if you are using the NobleServer directly you must make sure to call this method every frame.
|
static |
Initial timeout before resending refresh messages. This is doubled for each failed resend.
|
static |
Max number of times to try and resend refresh messages before giving up and shutting down the relay connection.
If refresh messages fail for 30 seconds the relay connection will be closed remotely regardless of these settings.
|
static |
How long a relay will stay alive without being refreshed (in seconds)
Setting this value higher means relays will stay alive longer even if the host temporarily loses connection or otherwise fails to send the refresh request in time. This can be helpful to maintain connection on an undependable network or when heavy application load (such as loading large levels synchronously) temporarily prevents requests from being processed. The drawback is that CCU is used for as long as the relay stays alive, so players that crash or otherwise don't clean up properly can cause lingering CCU usage for up to relayLifetime seconds.
|
static |
How often to refresh the relay to keep it alive, in seconds
|
static |
Request timeout.
This effects how long to wait before considering a request to have failed. Requests are used during the punchthrough process and for setting up and maintaining relays. If you are allowing cross-region play or expect high latency you can increase this so that requests won't time out. The drawback is that waiting longer for timeouts causes it take take longer to detect actual failed requests so the connection process may take longer.
|
staticget |
|
staticget |
|
staticgetset |
|
staticgetset |
This is the address that clients should connect to. It is assigned by the relay server.
Note that this is not the host's actual IP address, but one assigned to the host by the relay server. When clients connect to this address, Noble Connect will find the best possible connection and use it. This means that the client may actually end up connecting to an address on the local network, or an address on the router, or an address on the relay. But you don't need to worry about any of that, it is all handled for you internally.
|
staticget |
|
staticget |