fix(SimpleWebTransport): Implement OnServerConnectedWithAddress

This commit is contained in:
MrGadget 2024-07-20 10:53:06 -04:00
parent 96ddfa040d
commit ce0f70249b
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ namespace Mirror.SimpleWeb
{
public class SimpleWebServer
{
public event Action<int> onConnect;
public event Action<int, string> onConnect;
public event Action<int> onDisconnect;
public event Action<int, ArraySegment<byte>> onData;
public event Action<int, Exception> onError;
@ -91,7 +91,7 @@ public void ProcessMessageQueue(MonoBehaviour behaviour)
switch (next.type)
{
case EventType.Connected:
onConnect?.Invoke(next.connId);
onConnect?.Invoke(next.connId, GetClientAddress(next.connId));
break;
case EventType.Data:
onData?.Invoke(next.connId, next.data.ToSegment());

View File

@ -300,7 +300,7 @@ public override void ServerStart()
SslConfig config = SslConfigLoader.Load(sslEnabled, sslCertJson, sslProtocols);
server = new SimpleWebServer(serverMaxMsgsPerTick, TcpConfig, maxMessageSize, maxHandshakeSize, config);
server.onConnect += OnServerConnected.Invoke;
server.onConnect += OnServerConnectedWithAddress.Invoke;
server.onDisconnect += OnServerDisconnected.Invoke;
server.onData += (int connId, ArraySegment<byte> data) => OnServerDataReceived.Invoke(connId, data, Channels.Reliable);