Files
rosetta 83f38dc63f 'init'
2026-01-30 05:01:05 +02:00

28 lines
615 B
TypeScript

import Stream from "./stream";
/**
* Packet abstract class
*/
export default abstract class Packet {
/**
* Get the packet ID
* @returns packet ID
*/
public abstract getPacketId(): number;
/**
* Use the stream to read the packet and fill structure
* @param stream stream
*/
public abstract _receive(stream: Stream): void;
/**
* Use the stream to write the packet and return the stream
* @returns stream
*/
public abstract _send(): Promise<Stream> | Stream;
public clone(): Packet {
return new (this as any).constructor();
}
}