Skip to content

Commit

Permalink
feat: asynchronous transport (#134)
Browse files Browse the repository at this point in the history
Replaced Transport with AsyncTransport,  
Gets rid of transport singleton
Gets rid of connectionId

BREAKING CHANGE: connecition Id is gone
BREAKING CHANGE: websocket transport does not work,  needs to be replaced.
  • Loading branch information
paulpach committed Apr 1, 2020
1 parent 3a19e3a commit 0e84f45
Show file tree
Hide file tree
Showing 33 changed files with 805 additions and 1,437 deletions.
8 changes: 1 addition & 7 deletions Assets/Mirror/Components/Discovery/NetworkDiscovery.cs
Expand Up @@ -17,7 +17,7 @@ public class NetworkDiscovery : NetworkDiscoveryBase<ServerRequest, ServerRespon
public long ServerId { get; private set; }

[Tooltip("Transport to be advertised during discovery")]
public Transport transport;
public AsyncTransport transport;

[Tooltip("Invoked when a server is found")]
public ServerFoundUnityEvent OnServerFound;
Expand All @@ -26,12 +26,6 @@ public override void Start()
{
ServerId = RandomLong();

// active transport gets initialized in awake
// so make sure we set it here in Start() (after awakes)
// Or just let the user assign it in the inspector
if (transport == null)
transport = Transport.activeTransport;

base.Start();
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Mirror/Examples/ListServer/ListServers.cs
Expand Up @@ -186,7 +186,7 @@ public static void BalancePrefabs(GameObject prefab, int amount, Transform paren
void OnUI()
{
// only show while client not connected and server not started
if (!manager.isNetworkActive || IsConnecting())
if (!manager.IsNetworkActive || IsConnecting())
{
mainPanel.SetActive(true);

Expand Down
121 changes: 0 additions & 121 deletions Assets/Mirror/Runtime/LocalConnections.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Assets/Mirror/Runtime/NetworkBehaviour.cs
Expand Up @@ -231,7 +231,7 @@ protected void SendCommandInternal(Type invokeClass, string cmdName, NetworkWrit
payload = writer.ToArraySegment()
};

Client.Connection.Send(message, channelId);
_ = Client.SendAsync(message, channelId);
}

/// <summary>
Expand Down

0 comments on commit 0e84f45

Please sign in to comment.