@555platform/555-sdk-parser 中文文档教程
555 Platform Message Format and Chat Message Format Typescript Parser
所有平台消息格式函数都位于 PMF 命名空间中,而聊天消息格式函数则位于 CMF 命名空间中。
Install and Use
npm i @555platform/555parser.ts -S
import { PMF, CMF } from '@555platform/555parser.ts';
PMF Namespace Functions
- pmfBuilder(options: EnvelopeOptions, payload: object) - builds PMF message with specified payload
- pmfParser(message: Envelope) - returns payload object
- pmfNamespace(message: Envelope) - returns namespace in PMF Envelope
PMF Types
EnvelopeOptions = {
auth: string;
namespace: string;
tid?: string;
logLevel?: PmfLogLevels;
ttl?: number;
};
Envelope = {
auth: string;
mid: string;
namespace: string;
tid: string;
logLevel: PmfLogLevels;
ttl: number;
version: string;
timestamp: Date;
body: Object;
};
555 Platform Message Format and Chat Message Format Typescript Parser
All of the Platform Message Format functions reside in PMF namespace and Chat Message Format functions are in CMF namespace.
Install and Use
npm i @555platform/555parser.ts -S
import { PMF, CMF } from '@555platform/555parser.ts';
PMF Namespace Functions
- pmfBuilder(options: EnvelopeOptions, payload: object) - builds PMF message with specified payload
- pmfParser(message: Envelope) - returns payload object
- pmfNamespace(message: Envelope) - returns namespace in PMF Envelope
PMF Types
EnvelopeOptions = {
auth: string;
namespace: string;
tid?: string;
logLevel?: PmfLogLevels;
ttl?: number;
};
Envelope = {
auth: string;
mid: string;
namespace: string;
tid: string;
logLevel: PmfLogLevels;
ttl: number;
version: string;
timestamp: Date;
body: Object;
};