Alter pong packet to conform to the spec.
This commit is contained in:
parent
3c8bb88d53
commit
b026bad176
2 changed files with 2 additions and 14 deletions
SharpChat
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue