2023-10-14 15:05:58 +00:00
|
|
|
|
using AscNet.Common.MsgPack;
|
|
|
|
|
|
|
|
|
|
namespace AscNet.GameServer.Handlers
|
|
|
|
|
{
|
|
|
|
|
internal class HeartbeatModule
|
|
|
|
|
{
|
|
|
|
|
[RequestPacketHandler("HeartbeatRequest")]
|
|
|
|
|
public static void HeartbeatRequestHandler(Session session, Packet.Request packet)
|
|
|
|
|
{
|
|
|
|
|
HeartbeatResponse heartbeatResponse = new()
|
|
|
|
|
{
|
|
|
|
|
UtcServerTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
|
|
|
|
|
};
|
|
|
|
|
session.SendResponse(heartbeatResponse, packet.Id);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-14 18:01:21 +00:00
|
|
|
|
[RequestPacketHandler("Ping")]
|
|
|
|
|
public static void PingHandler(Session session, Packet.Request packet)
|
|
|
|
|
{
|
|
|
|
|
session.SendResponse(new Pong()
|
|
|
|
|
{
|
|
|
|
|
UtcTime = (ulong)DateTimeOffset.UtcNow.UtcTicks
|
|
|
|
|
}, packet.Id);
|
|
|
|
|
}
|
2023-10-14 15:05:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|