[FEAT] 실시간 채팅 시스템 구현 (WebSocket STOMP + Redis Pub/Sub)#33
Merged
nickhealthy merged 7 commits intodevelopfrom Feb 27, 2026
Merged
[FEAT] 실시간 채팅 시스템 구현 (WebSocket STOMP + Redis Pub/Sub)#33nickhealthy merged 7 commits intodevelopfrom
nickhealthy merged 7 commits intodevelopfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
WebSocket STOMP 프로토콜과 Redis Pub/Sub을 기반으로 실시간 채팅 시스템을 구현합니다.
스케일 아웃 환경에서도 다중 서버 간 메시지 브로드캐스트가 가능한 구조입니다.
구현 범위
인프라 / 설정
WebSocketConfig— STOMP 엔드포인트/ws, 브로커/topic/queue, 발행 prefix/appStompChannelInterceptor— CONNECT 시 JWT 토큰 검증 후Principal설정SecurityConfig—/ws/**경로 인증 없이 허용 (WebSocket handshake는 STOMP 레이어에서 인증)RedisConfig— JSON 직렬화chatRedisTemplate,RedisMessageListenerContainer추가Redis 실시간 서비스
ChatMessagePublisherchat:room:{roomId}채널로 메시지 발행ChatMessageSubscriberSimpMessagingTemplate으로 STOMP 브로드캐스트PresenceRedisServiceSessionRedisServiceUnreadCountRedisServiceMessageCacheRedisServiceWebSocket 핸들러 (STOMP)
/app/chat/{roomId}/send/app/chat/{roomId}/typing/app/chat/{roomId}/read/app/chat/{roomId}/join/app/chat/{roomId}/leaveREST API
POST/api/chat/roomsGET/api/chat/roomsGET/api/chat/rooms/{roomId}/messages/latestGET/api/chat/rooms/{roomId}/messages/syncafterMessageId기준)GET/api/chat/rooms/{roomId}/messages/beforebeforeMessageId기준)메시지 페이징 전략
createdAt대신 PK(id) 기반 커서 페이징 적용afterMessageId— 재접속 시 누락 복구beforeMessageId— 무한 스크롤 과거 조회커밋 구조
aeab863 feat: WebSocket STOMP 채팅 인프라 설정 (JWT 인터셉터, 보안 설정)
7ab3830 chore: 채팅 기능 공통 인프라 설정 (Redis 템플릿, 스케줄링, 에러코드)
bf52ab5 feat: Redis 기반 실시간 서비스 구현 (Pub/Sub, Presence, 세션, 캐시)
4efd53b feat: 채팅방/참여자 서비스 및 REST API 구현
18cb119 feat: 채팅 메시지 서비스 및 커서 기반 페이징 REST API 구현
105e38f feat: WebSocket STOMP 실시간 메시지 핸들러 구현
테스트
ChatMessageRepositoryTest— 커서 기반 조회 3개 케이스ChatMessageServiceTest— 메시지 전송, 읽음 처리, 커서 페이징ChatRoomServiceTest— 1:1 채팅방 생성, 중복 방지ChatParticipantServiceTest— 참여자 관리, 읽지 않은 메시지 DB 동기화