Alter pong packet to conform to the spec.

This commit is contained in:
flash 2025-04-20 23:41:40 +00:00
parent 3c8bb88d53
commit b026bad176
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
2 changed files with 2 additions and 14 deletions
SharpChat
Packet
PacketHandlers

View file

@ -4,20 +4,8 @@ using System.Text;
namespace SharpChat.Packet {
public class PongPacket : ServerPacket {
public DateTimeOffset PongTime { get; private set; }
public PongPacket(DateTimeOffset dto) {
PongTime = dto;
}
public override IEnumerable<string> Pack() {
StringBuilder sb = new();
sb.Append('0');
sb.Append('\t');
sb.Append(PongTime.ToUnixTimeSeconds());
yield return sb.ToString();
yield return "0\tpong";
}
}
}

View file

@ -26,7 +26,7 @@ namespace SharpChat.PacketHandlers {
return;
ctx.Connection.BumpPing();
ctx.Connection.Send(new PongPacket(ctx.Connection.LastPing));
ctx.Connection.Send(new PongPacket());
ctx.Chat.ContextAccess.Wait();
try {