sharp-chat/SharpChat/IServerPacket.cs

19 lines
546 B
C#

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
SequenceId = sequenceId > 0 ? sequenceId : SharpId.Next();
}
public abstract IEnumerable<string> Pack();
}
}