diff --git a/packages/server/src/upbit/SSE/sse.service.ts b/packages/server/src/upbit/SSE/sse.service.ts index 77e3e9a7..12c834e6 100644 --- a/packages/server/src/upbit/SSE/sse.service.ts +++ b/packages/server/src/upbit/SSE/sse.service.ts @@ -46,6 +46,7 @@ export class SseService implements OnModuleDestroy { async initOrderStream( coin: string, + dto: (data: any) => any, ): Promise { let coinLatestInfo = this.coinDataUpdaterService.getCoinOrderbookInfo(); @@ -58,15 +59,9 @@ export class SseService implements OnModuleDestroy { initData.type = "orderbook" initData.stream_type = "REALTIME" initData.code = initData.market; - delete initData.market; - initData.korean_name = this.coinDataUpdaterService - .getCoinNameList() - .get(initData.code); - - initData.image_url = `${UPBIT_IMAGE_URL}${initData.code.split('-')[1]}.png`; - + return new MessageEvent('orderbook-update', { - data: JSON.stringify(initData), + data: JSON.stringify(dto(initData)), }); } diff --git a/packages/server/src/upbit/upbit.controller.ts b/packages/server/src/upbit/upbit.controller.ts index 1fd4aad0..5ab09560 100644 --- a/packages/server/src/upbit/upbit.controller.ts +++ b/packages/server/src/upbit/upbit.controller.ts @@ -125,6 +125,7 @@ export class UpbitController { const initData$ = from( this.sseService.initOrderStream( coinsQuery, + this.coinListService.convertToCodeCoinDto, ), )