bug of stream is fixed

This commit is contained in:
병준 박 2019-09-25 15:35:06 +09:00
parent 17e3fdd790
commit 184f2365bb
5 changed files with 26 additions and 12 deletions

View File

@ -20,7 +20,7 @@ export interface EventSendRequest extends ProtocolRequest {
sentMessage: string; sentMessage: string;
} }
export interface EventSendResponse { export interface EventSendResponse extends ProtocolResponse {
// 대화방SEQ(s) // 대화방SEQ(s)
roomSeq: string; roomSeq: string;
// 이벤트SEQ(n) // 이벤트SEQ(n)

View File

@ -37,12 +37,18 @@ export class EventProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_INFO_REQ, ...encodeInfo(req)) .call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_INFO_REQ, ...encodeInfo(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_EVENT_INFO_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_EVENT_INFO_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_EVENT_INFO_DATA === res.subServiceType) { if (SSVC_TYPE_EVENT_INFO_DATA === res.subServiceType) {
return decodeInfoData(res); return {
...decodeInfoData(res),
Type: SSVC_TYPE_EVENT_INFO_DATA
};
} }
return decodeInfo(res); return {
...decodeInfo(res),
Type: SSVC_TYPE_EVENT_INFO_RES
};
}) })
); );
} }

View File

@ -150,7 +150,7 @@ export class RoomProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) { if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
return decodeRoomInfoData(res); return decodeRoomInfoData(res);

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, take, takeWhile } from 'rxjs/operators'; import { map, take, takeWhile, takeUntil } from 'rxjs/operators';
import { ProtocolService } from '@ucap-webmessenger/protocol'; import { ProtocolService } from '@ucap-webmessenger/protocol';
import { import {
@ -75,7 +75,7 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_BUDDY, SSVC_TYPE_SYNC_BUDDY_REQ, ...encodeBuddy(req)) .call(SVC_TYPE_SYNC_BUDDY, SSVC_TYPE_SYNC_BUDDY_REQ, ...encodeBuddy(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_BUDDY_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_SYNC_BUDDY_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_BUDDY_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_BUDDY_DATA === res.subServiceType) {
return decodeBuddyData(res); return decodeBuddyData(res);
@ -92,7 +92,10 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_BUDDY, SSVC_TYPE_SYNC_BUDDY2_REQ, ...encodeBuddy(req)) .call(SVC_TYPE_SYNC_BUDDY, SSVC_TYPE_SYNC_BUDDY2_REQ, ...encodeBuddy(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_BUDDY2_RES !== res.subServiceType), takeWhile(
res => SSVC_TYPE_SYNC_BUDDY2_RES !== res.subServiceType,
true
),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_BUDDY2_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_BUDDY2_DATA === res.subServiceType) {
return decodeBuddyDataDetail(res); return decodeBuddyDataDetail(res);
@ -109,7 +112,7 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_GROUP, SSVC_TYPE_SYNC_GROUP_REQ, ...encodeGroup(req)) .call(SVC_TYPE_SYNC_GROUP, SSVC_TYPE_SYNC_GROUP_REQ, ...encodeGroup(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_GROUP_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_GROUP_DATA === res.subServiceType) {
return decodeGroupData(res); return decodeGroupData(res);
@ -126,7 +129,10 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_GROUP, SSVC_TYPE_SYNC_GROUP_REQ2, ...encodeGroup(req)) .call(SVC_TYPE_SYNC_GROUP, SSVC_TYPE_SYNC_GROUP_REQ2, ...encodeGroup(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES2 !== res.subServiceType), takeWhile(
res => SSVC_TYPE_SYNC_GROUP_RES2 !== res.subServiceType,
true
),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_GROUP_DATA2 === res.subServiceType) { if (SSVC_TYPE_SYNC_GROUP_DATA2 === res.subServiceType) {
return decodeGroupDataDetail(res); return decodeGroupDataDetail(res);
@ -148,7 +154,7 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_ROOM, SSVC_TYPE_SYNC_ROOM_REQ, ...encodeRoom(req)) .call(SVC_TYPE_SYNC_ROOM, SSVC_TYPE_SYNC_ROOM_REQ, ...encodeRoom(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_ROOM_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_SYNC_ROOM_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_ROOM_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_ROOM_DATA === res.subServiceType) {
return decodeRoomData(res); return decodeRoomData(res);
@ -174,7 +180,7 @@ export class SyncProtocolService {
return this.protocolService return this.protocolService
.call(SVC_TYPE_SYNC_ROOM, SSVC_TYPE_SYNC_ROOM2_REQ, ...encodeRoom(req)) .call(SVC_TYPE_SYNC_ROOM, SSVC_TYPE_SYNC_ROOM2_REQ, ...encodeRoom(req))
.pipe( .pipe(
takeWhile(res => SSVC_TYPE_SYNC_ROOM2_RES !== res.subServiceType), takeWhile(res => SSVC_TYPE_SYNC_ROOM2_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_ROOM2_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_ROOM2_DATA === res.subServiceType) {
return decodeRoomData(res); return decodeRoomData(res);

View File

@ -6,10 +6,12 @@ export interface ProtocolRequest {
export interface ProtocolResponse { export interface ProtocolResponse {
_id?: string; _id?: string;
Type?: number;
} }
export interface ProtocolStream { export interface ProtocolStream {
_id?: string; _id?: string;
Type?: number;
} }
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface