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

View File

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

View File

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

View File

@ -5,7 +5,8 @@ import {
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
ProtocolMessage,
ProtocolNotification
} from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest {
@ -110,6 +111,15 @@ export interface UpdateFontResponse extends ProtocolResponse {
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> = (
req: UpdateFontRequest
) => {
@ -132,11 +142,11 @@ export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = (
};
export const decodeUpdateFontNotification: ProtocolDecoder<
UpdateFontResponse
UpdateFontNotification
> = (message: ProtocolMessage) => {
return {
roomSeq: message.bodyList[0],
fontColor: message.bodyList[1],
senderSeq: message.bodyList[2]
} as UpdateFontResponse;
} as UpdateFontNotification;
};

View File

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