sharp-chat/SharpChat/IServerPacket.cs

20 lines
546 B
C#
Raw Normal View History

2022-08-30 15:00:58 +00:00
using System.Collections.Generic;
namespace SharpChat {
public interface IServerPacket {
long SequenceId { get; }
IEnumerable<string> Pack();
}
public abstract class ServerPacket : IServerPacket {
public long SequenceId { get; }
public ServerPacket(long sequenceId = 0) {
// Allow sequence id to be manually set for potential message repeats
2023-02-16 22:56:50 +00:00
SequenceId = sequenceId > 0 ? sequenceId : SharpId.Next();
2022-08-30 15:00:58 +00:00
}
public abstract IEnumerable<string> Pack();
}
}