import { ProtocolRequest, ProtocolEncoder, PacketBody, ProtocolDecoder, ProtocolMessage, PacketBodyValue, ProtocolResponse, ProtocolNotification } from '@ucap-webmessenger/protocol'; export interface DelRequest extends ProtocolRequest { // 대화방SEQ(s) roomSeq: string; // 이벤트SEQ(n) eventSeq: number; } export interface DelResponse extends ProtocolResponse { // 대화방SEQ(s) roomSeq: string; // 이벤트SEQ(n) eventSeq: number; } export interface DelNotification extends ProtocolNotification { // 대화방SEQ(s) roomSeq: string; // 이벤트SEQ(n) eventSeq: number; } export const encodeDel: ProtocolEncoder = (req: DelRequest) => { const bodyList: PacketBody[] = []; bodyList.push( { type: PacketBodyValue.String, value: req.roomSeq }, { type: PacketBodyValue.Integer, value: req.eventSeq } ); return bodyList; }; export const decodeDel: ProtocolDecoder = ( message: ProtocolMessage ) => { return { roomSeq: message.bodyList[0], eventSeq: message.bodyList[1] } as DelResponse; }; export const decodeDelNotification: ProtocolDecoder = ( message: ProtocolMessage ) => { return { roomSeq: message.bodyList[0], eventSeq: message.bodyList[1] } as DelNotification; };