shardy
Version:
Framework for online games and applications on Node.js
18 lines (17 loc) • 417 B
TypeScript
export declare const BLOCK_HEAD = 4;
export interface BlockData {
type: BlockType;
body: Buffer;
}
export declare enum BlockType {
Handshake = 0,
HandshakeAcknowledgement = 1,
Heartbeat = 2,
Data = 3,
Kick = 4
}
export declare class Block {
static encode(type: BlockType, body: Buffer): Buffer;
static decode(data: Buffer): BlockData;
static check(type: BlockType): boolean;
}