Class Transport
Abstract transport layer component
Inheritance
Namespace: Mirror
Assembly: doc.dll
Syntax
public abstract class Transport : MonoBehaviour
Fields
| Improve this Doc View SourceactiveTransport
The current transport used by Mirror.
Declaration
public static Transport activeTransport
Field Value
Type | Description |
---|---|
Transport |
OnClientConnected
Called by Transport when the client connected to the server.
Declaration
public Action OnClientConnected
Field Value
Type | Description |
---|---|
Action |
OnClientDataReceived
Called by Transport when the client received a message from the server.
Declaration
public Action<ArraySegment<byte>, int> OnClientDataReceived
Field Value
Type | Description |
---|---|
Action<ArraySegment<Byte>, Int32> |
OnClientDataSent
Called by Transport when the client sent a message to the server.
Declaration
public Action<ArraySegment<byte>, int> OnClientDataSent
Field Value
Type | Description |
---|---|
Action<ArraySegment<Byte>, Int32> |
OnClientDisconnected
Called by Transport when the client disconnected from the server.
Declaration
public Action OnClientDisconnected
Field Value
Type | Description |
---|---|
Action |
OnClientError
Called by Transport when the client encountered an error.
Declaration
public Action<TransportError, string> OnClientError
Field Value
Type | Description |
---|---|
Action<TransportError, String> |
OnServerConnected
Called by Transport when a new client connected to the server.
Declaration
public Action<int> OnServerConnected
Field Value
Type | Description |
---|---|
Action<Int32> |
OnServerDataReceived
Called by Transport when the server received a message from a client.
Declaration
public Action<int, ArraySegment<byte>, int> OnServerDataReceived
Field Value
Type | Description |
---|---|
Action<Int32, ArraySegment<Byte>, Int32> |
OnServerDataSent
Called by Transport when the server sent a message to a client.
Declaration
public Action<int, ArraySegment<byte>, int> OnServerDataSent
Field Value
Type | Description |
---|---|
Action<Int32, ArraySegment<Byte>, Int32> |
OnServerDisconnected
Called by Transport when a client disconnected from the server.
Declaration
public Action<int> OnServerDisconnected
Field Value
Type | Description |
---|---|
Action<Int32> |
OnServerError
Called by Transport when a server's connection encountered a problem.
Declaration
public Action<int, TransportError, string> OnServerError
Field Value
Type | Description |
---|---|
Action<Int32, TransportError, String> |
Methods
| Improve this Doc View SourceAvailable()
Is this transport available in the current platform?
Declaration
public abstract bool Available()
Returns
Type | Description |
---|---|
Boolean |
ClientConnect(String)
Connects the client to the server at the address.
Declaration
public abstract void ClientConnect(string address)
Parameters
Type | Name | Description |
---|---|---|
String | address |
ClientConnect(Uri)
Connects the client to the server at the Uri.
Declaration
public virtual void ClientConnect(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri |
ClientConnected()
True if the client is currently connected to the server.
Declaration
public abstract bool ClientConnected()
Returns
Type | Description |
---|---|
Boolean |
ClientDisconnect()
Disconnects the client from the server
Declaration
public abstract void ClientDisconnect()
ClientEarlyUpdate()
NetworkLoop NetworkEarly/LateUpdate were added for a proper network update order. the goal is to: process_incoming() update_world() process_outgoing() in order to avoid unnecessary latency and data races.
Declaration
public virtual void ClientEarlyUpdate()
ClientLateUpdate()
Declaration
public virtual void ClientLateUpdate()
ClientSend(ArraySegment<Byte>, Int32)
Sends a message to the server over the given channel.
Declaration
public abstract void ClientSend(ArraySegment<byte> segment, int channelId = null)
Parameters
Type | Name | Description |
---|---|---|
ArraySegment<Byte> | segment | |
Int32 | channelId |
GetBatchThreshold(Int32)
Recommended Batching threshold for this transport.
Declaration
public virtual int GetBatchThreshold(int channelId = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | channelId |
Returns
Type | Description |
---|---|
Int32 |
GetMaxPacketSize(Int32)
Maximum message size for the given channel.
Declaration
public abstract int GetMaxPacketSize(int channelId = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | channelId |
Returns
Type | Description |
---|---|
Int32 |
LateUpdate()
Declaration
public void LateUpdate()
OnApplicationQuit()
Called by Unity when quitting. Inheriting Transports should call base for proper Shutdown.
Declaration
public virtual void OnApplicationQuit()
ServerActive()
True if the server is currently listening for connections.
Declaration
public abstract bool ServerActive()
Returns
Type | Description |
---|---|
Boolean |
ServerDisconnect(Int32)
Disconnect a client from the server.
Declaration
public abstract void ServerDisconnect(int connectionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | connectionId |
ServerEarlyUpdate()
Declaration
public virtual void ServerEarlyUpdate()
ServerGetClientAddress(Int32)
Get a client's address on the server.
Declaration
public abstract string ServerGetClientAddress(int connectionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | connectionId |
Returns
Type | Description |
---|---|
String |
ServerLateUpdate()
Declaration
public virtual void ServerLateUpdate()
ServerSend(Int32, ArraySegment<Byte>, Int32)
Send a message to a client over the given channel.
Declaration
public abstract void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | connectionId | |
ArraySegment<Byte> | segment | |
Int32 | channelId |
ServerStart()
Start listening for connections.
Declaration
public abstract void ServerStart()
ServerStop()
Stop listening and disconnect all connections.
Declaration
public abstract void ServerStop()
ServerUri()
Returns server address as Uri.
Declaration
public abstract Uri ServerUri()
Returns
Type | Description |
---|---|
Uri |
Shutdown()
Shut down the transport, both as client and server
Declaration
public abstract void Shutdown()
Update()
Declaration
public void Update()