shardy
Version:
Framework for online games and applications on Node.js
20 lines (19 loc) • 644 B
TypeScript
import { Serializer } from './Serializer';
export declare enum PayloadType {
Request = 0,
Command = 1,
Response = 2
}
export interface PayloadData {
type: PayloadType;
name: string;
id: number;
data: Buffer;
error: string;
}
export declare class Payload {
static encode(serializer: Serializer, type: PayloadType, name: string, id: number, data?: Buffer, error?: string): Buffer;
static decode(serializer: Serializer, data: Buffer): PayloadData;
static create(type: PayloadType, name: string, id: number, data?: Buffer, error?: string): PayloadData;
static check(payload: PayloadData): boolean;
}