From f2d29a838a13d928382a03110208f2513594cbc7 Mon Sep 17 00:00:00 2001 From: sb Date: Sun, 12 Jul 2026 11:26:06 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20createSpotChat=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?(=EC=8A=A4=ED=8C=9F=20=EC=B1=84=ED=8C=85=20=EC=A0=95=EB=A6=AC?= =?UTF-8?q?=20=ED=9B=84=EC=86=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/chatSocket.ts | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/lib/chatSocket.ts b/src/lib/chatSocket.ts index 6b99610..238e3ef 100644 --- a/src/lib/chatSocket.ts +++ b/src/lib/chatSocket.ts @@ -24,42 +24,6 @@ function stompClient(onConnect: (c: Client) => void, onStatus?: (connected: bool return client } -/** - * 스팟 채팅용 STOMP 클라이언트. - * connect 후 스팟 토픽을 구독하고, send 로 메시지를 전송한다. - */ -export function createSpotChat( - spotId: number, - onMessage: (m: ChatMessage) => void, - onStatus?: (connected: boolean) => void, -) { - const client = new Client({ - brokerURL: wsUrl(), - connectHeaders: { Authorization: `Bearer ${tokenStore.get() ?? ''}` }, - reconnectDelay: 3000, - onConnect: () => { - onStatus?.(true) - client.subscribe(`/topic/spots/${spotId}`, (msg: IMessage) => { - onMessage(JSON.parse(msg.body) as ChatMessage) - }) - }, - onDisconnect: () => onStatus?.(false), - onWebSocketClose: () => onStatus?.(false), - }) - - return { - activate: () => client.activate(), - deactivate: () => client.deactivate(), - send: (content: string) => { - client.publish({ - destination: `/app/spots/${spotId}/chat`, - body: JSON.stringify({ content }), - }) - }, - isConnected: () => client.connected, - } -} - /** 매칭 수락으로 열린 1:1 채팅용 STOMP 클라이언트. */ export function createMatchChat( matchId: number,