mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
fix(SimpleWebTransport): Implement OnServerConnectedWithAddress
This commit is contained in:
parent
96ddfa040d
commit
ce0f70249b
@ -6,7 +6,7 @@ namespace Mirror.SimpleWeb
|
|||||||
{
|
{
|
||||||
public class SimpleWebServer
|
public class SimpleWebServer
|
||||||
{
|
{
|
||||||
public event Action<int> onConnect;
|
public event Action<int, string> onConnect;
|
||||||
public event Action<int> onDisconnect;
|
public event Action<int> onDisconnect;
|
||||||
public event Action<int, ArraySegment<byte>> onData;
|
public event Action<int, ArraySegment<byte>> onData;
|
||||||
public event Action<int, Exception> onError;
|
public event Action<int, Exception> onError;
|
||||||
@ -91,7 +91,7 @@ public void ProcessMessageQueue(MonoBehaviour behaviour)
|
|||||||
switch (next.type)
|
switch (next.type)
|
||||||
{
|
{
|
||||||
case EventType.Connected:
|
case EventType.Connected:
|
||||||
onConnect?.Invoke(next.connId);
|
onConnect?.Invoke(next.connId, GetClientAddress(next.connId));
|
||||||
break;
|
break;
|
||||||
case EventType.Data:
|
case EventType.Data:
|
||||||
onData?.Invoke(next.connId, next.data.ToSegment());
|
onData?.Invoke(next.connId, next.data.ToSegment());
|
||||||
|
@ -300,7 +300,7 @@ public override void ServerStart()
|
|||||||
SslConfig config = SslConfigLoader.Load(sslEnabled, sslCertJson, sslProtocols);
|
SslConfig config = SslConfigLoader.Load(sslEnabled, sslCertJson, sslProtocols);
|
||||||
server = new SimpleWebServer(serverMaxMsgsPerTick, TcpConfig, maxMessageSize, maxHandshakeSize, config);
|
server = new SimpleWebServer(serverMaxMsgsPerTick, TcpConfig, maxMessageSize, maxHandshakeSize, config);
|
||||||
|
|
||||||
server.onConnect += OnServerConnected.Invoke;
|
server.onConnect += OnServerConnectedWithAddress.Invoke;
|
||||||
server.onDisconnect += OnServerDisconnected.Invoke;
|
server.onDisconnect += OnServerDisconnected.Invoke;
|
||||||
server.onData += (int connId, ArraySegment<byte> data) => OnServerDataReceived.Invoke(connId, data, Channels.Reliable);
|
server.onData += (int connId, ArraySegment<byte> data) => OnServerDataReceived.Invoke(connId, data, Channels.Reliable);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user