sharp-chat/SharpChat/IServerPacket.cs

17 lines
485 B
C#

namespace SharpChat {
public interface IServerPacket {
long SequenceId { get; }
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
SequenceId = sequenceId > 0 ? sequenceId : SharpId.Next();
}
public abstract string Pack();
}
}