milimoe 14ff58f4f4
为服务器统一数据访问连接 (#37)
* 添加 Web API 和 RESTful API 模式;
* 添加 SQLite 模式;
* 添加 ISocketMessageProcessor 和 ISocketListener<> 接口,用于统一数据访问;
* 重做了 ISocketModel;
* 完善了 WebSocket 的连接模式。
2024-10-04 12:39:15 +08:00

50 lines
1.2 KiB
C#

using Milimoe.FunGame.Core.Interface.Base;
using Milimoe.FunGame.Core.Library.Common.Network;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.WebAPI.Architecture
{
public class RESTfulAPI(Guid token, string clientip, string clientname) : ISocketMessageProcessor
{
public Type InstanceType => typeof(RESTfulAPI);
public Guid Token { get; init; } = token;
public string ClientIP { get; init; } = clientip;
public string ClientName { get; init; } = clientname;
public void Close()
{
}
public async Task CloseAsync()
{
await Task.Delay(100);
}
public SocketObject[] Receive()
{
return [];
}
public async Task<SocketObject[]> ReceiveAsync()
{
await Task.Delay(100);
return [];
}
public SocketResult Send(SocketMessageType type, params object[] objs)
{
return SocketResult.Success;
}
public async Task<SocketResult> SendAsync(SocketMessageType type, params object[] objs)
{
await Task.Delay(100);
return SocketResult.Success;
}
}
}