Parent Epic
선행 작업
Story 개요
현재 useChatWebSocket.js 훅을 채팅 전용과 게임 전용으로 분리하여
책임을 명확히 하고 유지보수성을 개선합니다.
현재 구조
```
src/domains/freetalk/hooks/
└── useChatWebSocket.js (채팅 + 게임 혼합)
- messages[], isConnected
- gameState, receivedDrawing
- correctAnswerBubble, shouldClearCanvas
```
변경 후 구조
```
src/domains/chat/hooks/
└── useChatWebSocket.js (채팅 전용)
- messages[], isConnected
- connect(), disconnect()
- sendMessage()
src/domains/catchmind/hooks/
├── useGameWebSocket.js (게임 전용)
│ - gameState, isGameActive
│ - startGame(), stopGame()
│ - sendDrawing(), clearDrawing()
├── useGameState.js (게임 상태 관리)
│ - currentRound, scores, currentDrawerId
└── useTimer.js (타이머 전용)
- remainingTime, isRunning
```
Acceptance Criteria
Tasks
기술 명세
useTimer.js
```javascript
export function useTimer(roundStartTime, roundDuration, serverTime) {
const [remainingTime, setRemainingTime] = useState(roundDuration);
// 서버-클라이언트 시간 차이 보정
// 100ms 간격 업데이트
return remainingTime;
}
```
useGameWebSocket.js
```javascript
export function useGameWebSocket(roomId, userId) {
const [gameState, setGameState] = useState(null);
const [receivedDrawing, setReceivedDrawing] = useState(null);
// Game domain 메시지만 처리
const handleGameMessage = (message) => {
switch (message.messageType) {
case 'GAME_START': ...
case 'ROUND_START': ...
case 'DRAWING': ...
}
};
return { gameState, receivedDrawing, startGame, stopGame, sendDrawing };
}
```
우선순위
🟡 중간 - 안정화 및 확장성 개선
예상 작업량
Parent Epic
선행 작업
Story 개요
현재
useChatWebSocket.js훅을 채팅 전용과 게임 전용으로 분리하여책임을 명확히 하고 유지보수성을 개선합니다.
현재 구조
```
src/domains/freetalk/hooks/
└── useChatWebSocket.js (채팅 + 게임 혼합)
- messages[], isConnected
- gameState, receivedDrawing
- correctAnswerBubble, shouldClearCanvas
```
변경 후 구조
```
src/domains/chat/hooks/
└── useChatWebSocket.js (채팅 전용)
- messages[], isConnected
- connect(), disconnect()
- sendMessage()
src/domains/catchmind/hooks/
├── useGameWebSocket.js (게임 전용)
│ - gameState, isGameActive
│ - startGame(), stopGame()
│ - sendDrawing(), clearDrawing()
├── useGameState.js (게임 상태 관리)
│ - currentRound, scores, currentDrawerId
└── useTimer.js (타이머 전용)
- remainingTime, isRunning
```
Acceptance Criteria
Tasks
기술 명세
useTimer.js
```javascript
export function useTimer(roundStartTime, roundDuration, serverTime) {
const [remainingTime, setRemainingTime] = useState(roundDuration);
// 서버-클라이언트 시간 차이 보정
// 100ms 간격 업데이트
return remainingTime;
}
```
useGameWebSocket.js
```javascript
export function useGameWebSocket(roomId, userId) {
const [gameState, setGameState] = useState(null);
const [receivedDrawing, setReceivedDrawing] = useState(null);
}
```
우선순위
🟡 중간 - 안정화 및 확장성 개선
예상 작업량