mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-22 12:09:36 +08:00

* 添加 Web API 和 RESTful API 模式; * 添加 SQLite 模式; * 添加 ISocketMessageProcessor 和 ISocketListener<> 接口,用于统一数据访问; * 重做了 ISocketModel; * 完善了 WebSocket 的连接模式。
50 lines
1.2 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|