sharp-chat/SharpChat.Protocol.SockChat/Packets/PongPacket.cs

24 lines
601 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Events;
using System;
using System.Text;
namespace SharpChat.Protocol.SockChat.Packets {
public class PongPacket : ServerPacket {
public DateTimeOffset PongTime { get; private set; }
public PongPacket(SessionPingEvent spe) {
PongTime = spe.DateTime;
}
protected override string DoPack() {
StringBuilder sb = new();
sb.Append((int)ServerPacketId.Pong);
sb.Append(IServerPacket.SEPARATOR);
sb.Append(PongTime.ToUnixTimeSeconds());
return sb.ToString();
}
}
}