bug fixed and rename

This commit is contained in:
leejh 2019-09-25 17:33:44 +09:00
parent e4a03d431a
commit 0beb440dcc
5 changed files with 79 additions and 23 deletions

View File

@ -6,7 +6,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolStream, ProtocolStream,
PacketBodyValue PacketBodyValue,
ProtocolNotification
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EventType } from '../types/event.type'; import { EventType } from '../types/event.type';
import { PushStatus } from '../types/pushStatus.type'; import { PushStatus } from '../types/pushStatus.type';
@ -41,17 +42,25 @@ export interface SendResponse extends ProtocolResponse {
senderName: string; senderName: string;
} }
export interface SendNotification extends SendResponse { export interface SendNotification extends ProtocolNotification {
// 대화방SEQ(s) // 대화방SEQ(s)
roomSeq: string;
// 이벤트SEQ(n) // 이벤트SEQ(n)
seq: number;
// 이벤트타입(s) // 이벤트타입(s)
type: EventType;
// 발생일시(s) // 발생일시(s)
sendDate: string;
// 이벤트내용(s) // 이벤트내용(s)
message: string;
// 수신자수 // 수신자수
receiverCount: number;
// 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트 // 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트
pushStatus: PushStatus;
// 강퇴 타입(s) // 강퇴 타입(s)
ForcedExitType: string;
// 요청자 이름(s) // 요청자 이름(s)
senderName: string;
// 사용자아이디(s) // 사용자아이디(s)
id?: string; id?: string;
// 회사코드(s) // 회사코드(s)

View File

@ -5,7 +5,9 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
BodyStringDivider,
ProtocolNotification
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { RoomExitType } from '../types/room.type'; import { RoomExitType } from '../types/room.type';
@ -19,6 +21,11 @@ export interface ExitResponse extends ProtocolResponse {
roomSeq: string; roomSeq: string;
} }
export interface ExitNotification extends ProtocolNotification {
// 대화방SEQ(s)
roomSeq: string;
}
export const encodeExit: ProtocolEncoder<ExitRequest> = (req: ExitRequest) => { export const encodeExit: ProtocolEncoder<ExitRequest> = (req: ExitRequest) => {
const bodyList: PacketBody[] = []; const bodyList: PacketBody[] = [];
@ -33,18 +40,22 @@ export const decodeExit: ProtocolDecoder<ExitResponse> = (
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as ExitResponse; } as ExitResponse;
}; };
export const decodeExitNotification: ProtocolDecoder<ExitResponse> = ( export const decodeExitNotification: ProtocolDecoder<ExitNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as ExitResponse; } as ExitNotification;
}; };
export interface ExitAllRequest extends ProtocolRequest { export interface ExitAllRequest extends ProtocolRequest {
// 대화방SEQ(s) // 대화방SEQ(s)
roomSeq: string[]; roomSeq: string[];
} }
export interface ExitAllResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string[];
}
export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = ( export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = (
req: ExitAllRequest req: ExitAllRequest
@ -54,6 +65,13 @@ export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = (
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq.join(',') }); bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq.join(',') });
return bodyList; return bodyList;
}; };
export const decodeAllExit: ProtocolDecoder<ExitAllResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0].split(BodyStringDivider)
} as ExitAllResponse;
};
export interface ExitForcingRequest extends ProtocolRequest { export interface ExitForcingRequest extends ProtocolRequest {
// 대화방SEQ(s) // 대화방SEQ(s)
@ -77,6 +95,17 @@ export interface ExitForcingResponse extends ProtocolRequest {
userSeqs: number[]; userSeqs: number[];
} }
export interface ExitForcingNotification extends ProtocolNotification {
// 대화방SEQ(s)
roomSeq: string;
// 강퇴요청타입(s)
type: RoomExitType;
// sender사용자SEQ(n)
senderSeq: number;
// 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeExitForcing: ProtocolEncoder<ExitForcingRequest> = ( export const encodeExitForcing: ProtocolEncoder<ExitForcingRequest> = (
req: ExitForcingRequest req: ExitForcingRequest
) => { ) => {
@ -106,7 +135,7 @@ export const decodeExitForcing: ProtocolDecoder<ExitForcingResponse> = (
} as ExitForcingResponse; } as ExitForcingResponse;
}; };
export const decodeExitForcingNotification: ProtocolDecoder< export const decodeExitForcingNotification: ProtocolDecoder<
ExitForcingResponse ExitForcingNotification
> = (message: ProtocolMessage) => { > = (message: ProtocolMessage) => {
let userSeqs: number[] = []; let userSeqs: number[] = [];
if (message.bodyList.length > 3) { if (message.bodyList.length > 3) {
@ -117,5 +146,5 @@ export const decodeExitForcingNotification: ProtocolDecoder<
type: message.bodyList[1] as RoomExitType, type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2], senderSeq: message.bodyList[2],
userSeqs userSeqs
} as ExitForcingResponse; } as ExitForcingNotification;
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
ProtocolNotification
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface InviteRequest extends ProtocolRequest { export interface InviteRequest extends ProtocolRequest {
@ -19,6 +20,10 @@ export interface InviteResponse extends ProtocolResponse {
// 0. 대화방SEQ(s) // 0. 대화방SEQ(s)
roomSeq: string; roomSeq: string;
} }
export interface InviteNotification extends ProtocolNotification {
// 0. 대화방SEQ(s)
roomSeq: string;
}
export const encodeInvite: ProtocolEncoder<InviteRequest> = ( export const encodeInvite: ProtocolEncoder<InviteRequest> = (
req: InviteRequest req: InviteRequest
@ -41,10 +46,10 @@ export const decodeInvite: ProtocolDecoder<InviteResponse> = (
} as InviteResponse; } as InviteResponse;
}; };
export const decodeInviteNotification: ProtocolDecoder<InviteResponse> = ( export const decodeInviteNotification: ProtocolDecoder<InviteNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as InviteResponse; } as InviteNotification;
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
ProtocolNotification
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest { export interface UpdateRequest extends ProtocolRequest {
@ -110,6 +111,15 @@ export interface UpdateFontResponse extends ProtocolResponse {
senderSeq: number; senderSeq: number;
} }
export interface UpdateFontNotification extends ProtocolNotification {
// 대화방SEQ(s)
roomSeq: string;
// 폰트색(s) cf)0x000000 형태의 스트링
fontColor: string;
// sender사용자SEQ(n)
senderSeq: number;
}
export const encodeUpdateFont: ProtocolEncoder<UpdateFontRequest> = ( export const encodeUpdateFont: ProtocolEncoder<UpdateFontRequest> = (
req: UpdateFontRequest req: UpdateFontRequest
) => { ) => {
@ -132,11 +142,11 @@ export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = (
}; };
export const decodeUpdateFontNotification: ProtocolDecoder< export const decodeUpdateFontNotification: ProtocolDecoder<
UpdateFontResponse UpdateFontNotification
> = (message: ProtocolMessage) => { > = (message: ProtocolMessage) => {
return { return {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
fontColor: message.bodyList[1], fontColor: message.bodyList[1],
senderSeq: message.bodyList[2] senderSeq: message.bodyList[2]
} as UpdateFontResponse; } as UpdateFontNotification;
}; };

View File

@ -74,7 +74,9 @@ import {
ExitForcingRequest, ExitForcingRequest,
ExitForcingResponse, ExitForcingResponse,
encodeExitForcing, encodeExitForcing,
decodeExitForcing decodeExitForcing,
decodeAllExit,
ExitAllResponse
} from '../models/exit'; } from '../models/exit';
import { import {
UpdateRequest, UpdateRequest,
@ -172,8 +174,8 @@ export class RoomProtocolService {
...encodeUserStatusOffline(req) ...encodeUserStatusOffline(req)
) )
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeUserStatusOffline(res); return decodeUserStatusOffline(res);
}) })
); );
@ -183,18 +185,19 @@ export class RoomProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeExit(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeExit(req))
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeExit(res); return decodeExit(res);
}) })
); );
} }
public exitAll(req: ExitAllRequest): Observable<void> { public exitAll(req: ExitAllRequest): Observable<ExitAllResponse> {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_ALL_REQ, ...encodeAllExit(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_ALL_REQ, ...encodeAllExit(req))
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1); return decodeAllExit(res);
}) })
); );
} }
@ -206,8 +209,8 @@ export class RoomProtocolService {
...encodeExitForcing(req) ...encodeExitForcing(req)
) )
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeExitForcing(res); return decodeExitForcing(res);
}) })
); );
@ -217,8 +220,8 @@ export class RoomProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeUpdate(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeUpdate(req))
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeUpdate(res); return decodeUpdate(res);
}) })
); );
@ -233,8 +236,8 @@ export class RoomProtocolService {
...encodeUpdateTimerSet(req) ...encodeUpdateTimerSet(req)
) )
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeUpdateTimerSet(res); return decodeUpdateTimerSet(res);
}) })
); );
@ -247,8 +250,8 @@ export class RoomProtocolService {
...encodeUpdateFont(req) ...encodeUpdateFont(req)
) )
.pipe( .pipe(
take(1),
map(res => { map(res => {
take(1);
return decodeUpdateFont(res); return decodeUpdateFont(res);
}) })
); );