-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Stack
- Spring WebSocket + STOMP
- Kafka
- FCM
- MongoDB(Message), S3(File), Redis(Status)
TODO
- WebSocket/STOMP 엔드포인트 개설 (/ws), 앱 프리픽스(/dorumdorum), 브로커(/topic, /queue) 설정
- JWT 인증: HandshakeInterceptor에서 토큰 검증 → Principal(userId) 주입 -> @currentuser 추출
- 메시지 DTO 정의: SendMessage, MessageDelivered, MessageRead, Typing, PresenceEvent
- 컨트롤러:
- @MessageMapping("/chat.send") → Kafka chat-events 토픽으로 발행
-@MessageMapping("/chat.read")
- @MessageMapping("/chat.send") → Kafka chat-events 토픽으로 발행
- Kafka 연동:
- Producer/Consumer 설정, Topic(예: chat-events, presence-events) 생성
- 파티션 키 = conversationId로 고정(메시지 순서 보존)
- 메시지 퍼시스터(컨슈머): Kafka → DB(MongoDB 또는 MySQL) 저장 서비스
- 오프라인 딜리버리: 접속 끊긴 사용자에게 미수신 메시지 큐/조회 API 준비
- Presence(온라인 여부):
- Redis 키 설계: ONLINE:USER:{userId}, ONLINE:USER:{userId}, LAST_SEEN:USER:{userId}
- SessionConnect/Disconnect 이벤트 훅으로 키/TTL 갱신
- @MessageMapping("/ping") 하트비트로 TTL 연장
- 읽음/배달 영수증: 메시지 수신 시 /user/queue/ack로 에코, participant.lastReadMessageId 업데이트 API
- 파일/이미지 전송: S3 Presigned URL 발급 API, 미디어 메타 DB 저장