chore: update naming game -> simple server
This commit is contained in:
@@ -54,7 +54,7 @@ namespace Ragon.Core
|
||||
_thread = new Thread(Execute);
|
||||
_thread.Name = "NetworkThread";
|
||||
_thread.Start();
|
||||
_logger.Info($"Socket Server Started at port {port}");
|
||||
_logger.Info($"ENet Server Started at port {port}");
|
||||
}
|
||||
|
||||
private void Execute()
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using DisruptorUnity3d;
|
||||
using NLog;
|
||||
|
||||
namespace Ragon.Core;
|
||||
|
||||
public class WebsocketServer : IDisposable
|
||||
{
|
||||
private HttpListener _httpListener;
|
||||
private ILogger _logger = LogManager.GetCurrentClassLogger();
|
||||
private Thread _thread;
|
||||
private ENet.Event _netEvent;
|
||||
|
||||
private RingBuffer<Event> _receiveBuffer;
|
||||
private RingBuffer<Event> _sendBuffer;
|
||||
|
||||
public void WriteEvent(Event evnt) => _sendBuffer.Enqueue(evnt);
|
||||
public bool ReadEvent(out Event evnt) => _receiveBuffer.TryDequeue(out evnt);
|
||||
|
||||
public void Start(ushort port)
|
||||
{
|
||||
// _httpListener = new HttpListener();
|
||||
// _httpListener.Prefixes.Add("http://localhost/");
|
||||
// _httpListener.Start();
|
||||
//
|
||||
// _thread = new Thread(Execute);
|
||||
// _thread.Name = "NetworkThread";
|
||||
// _thread.Start();
|
||||
// _logger.Info($"Socket Server Started at port {port}");
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async void ExecuteAsync()
|
||||
{
|
||||
// while (true)
|
||||
// {
|
||||
// HttpListenerContext context = await _httpListener.GetContextAsync();
|
||||
// if (context.Request.IsWebSocketRequest)
|
||||
// {
|
||||
// HttpListenerWebSocketContext webSocketContext = await context.AcceptWebSocketAsync(null);
|
||||
// WebSocket webSocket = webSocketContext.WebSocket;
|
||||
// while (webSocket.State == WebSocketState.Open)
|
||||
// {
|
||||
// await webSocket.SendAsync(... );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace Ragon.Core.Storage;
|
||||
|
||||
public class Storage
|
||||
{
|
||||
private ConnectionMultiplexer _connection;
|
||||
// private ConnectionMultiplexer _connection;
|
||||
|
||||
public Storage(Configuration _configuration)
|
||||
{
|
||||
_connection = ConnectionMultiplexer.Connect(_configuration.ApiKey);
|
||||
// _connection = ConnectionMultiplexer.Connect(_configuration.Key);
|
||||
}
|
||||
|
||||
public void UpdateEntity(int entityId)
|
||||
{
|
||||
var db = _connection.GetDatabase();
|
||||
// var db = _connection.GetDatabase();
|
||||
|
||||
// db.set("entity_", )
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Ragon.Core;
|
||||
|
||||
public class WebsocketServer
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user