Skip to content

Commit

Permalink
♻️ refactor: 사용하지 않는 SSE 코드 제거#250
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuo3o committed Dec 2, 2024
1 parent f8b41ef commit 576d8c7
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions BE/src/stockSocket/stock-price-socket.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { filter, map, Observable, Subject } from 'rxjs';
import { BaseSocketDomainService } from '../common/websocket/base-socket.domain-service';
import { SocketGateway } from '../common/websocket/socket.gateway';
import { BaseStockSocketDomainService } from './base-stock-socket.domain-service';
Expand All @@ -8,12 +7,10 @@ import { StatusType } from '../stock/order/enum/status-type';
import { TodayStockTradeHistoryDataDto } from '../stock/trade/history/dto/today-stock-trade-history-data.dto';
import { StockDetailSocketDataDto } from '../stock/trade/history/dto/stock-detail-socket-data.dto';
import { StockExecuteOrderRepository } from './stock-execute-order.repository';
import { SseEvent } from '../stock/trade/history/interface/sse-event';

@Injectable()
export class StockPriceSocketService extends BaseStockSocketDomainService {
private connection: { [key: string]: number } = {};
private eventSubject = new Subject<SseEvent>();

constructor(
protected readonly socketGateway: SocketGateway,
Expand Down Expand Up @@ -55,12 +52,6 @@ export class StockPriceSocketService extends BaseStockSocketDomainService {
prdy_ctrt: data[5],
};

this.eventSubject.next({
data: JSON.stringify({
tradeData,
}),
});

this.socketGateway.sendStockIndexValueToClient(
`trade-history/${data[0]}`,
tradeData,
Expand All @@ -72,16 +63,6 @@ export class StockPriceSocketService extends BaseStockSocketDomainService {
);
}

getTradeDataStream(targetStockCode: string): Observable<SseEvent> {
return this.eventSubject.pipe(
filter((event: SseEvent) => {
const parsed = JSON.parse(event.data);
return parsed.tradeData.stck_shrn_iscd === targetStockCode;
}),
map((event: SseEvent) => event),
);
}

subscribeByCode(trKey: string) {
this.baseSocketDomainService.registerCode(this.TR_ID, trKey);

Expand Down

0 comments on commit 576d8c7

Please sign in to comment.