feat: websockets

This commit is contained in:
2022-12-20 12:20:52 -08:00
parent ab85578ccf
commit a5a67963be
24 changed files with 276 additions and 69 deletions
+4 -4
View File
@@ -5,13 +5,13 @@ namespace Ragon.Server.ENet;
public sealed class ENetConnection: INetworkConnection
{
public ushort Id { get; }
public INetworkChannel ReliableChannel { get; private set; }
public INetworkChannel UnreliableChannel { get; private set; }
public INetworkChannel Reliable { get; private set; }
public INetworkChannel Unreliable { get; private set; }
public ENetConnection(Peer peer)
{
Id = (ushort) peer.ID;
ReliableChannel = new ENetReliableChannel(peer, 0);
UnreliableChannel = new ENetUnreliableChannel(peer, 1);
Reliable = new ENetReliableChannel(peer, 0);
Unreliable = new ENetUnreliableChannel(peer, 1);
}
}
+2 -2
View File
@@ -63,7 +63,8 @@ namespace Ragon.Server.ENet
{
if (!IsValidProtocol(_event.Data))
{
_logger.Warn("Mismatched protocol, close connection");
_logger.Warn($"Mismatched protocol Server: {RagonVersion.Parse(_protocol)} Client: {RagonVersion.Parse(_event.Data)}, close connection");
_event.Peer.DisconnectNow(0);
break;
}
@@ -109,7 +110,6 @@ namespace Ragon.Server.ENet
private bool IsValidProtocol(uint protocol)
{
Console.WriteLine($"{protocol} {_protocol}");
return protocol == _protocol;
}
}