feat: 알림 실시간 채널 (SSE) - #117
Merged
Merged
Conversation
GET /notifications/stream 으로 새 알림을 즉시 받는다. - WebSocket 대신 SSE: 알림은 한 방향이라, 기존 JWT 필터·인가·CORS 를 그대로 쓰는 쪽을 골랐다. - 알림 엔티티 @PostPersist 에서 이벤트를 올리고 커밋 뒤에 보낸다. 알림을 만드는 경로가 여럿이라 (서비스·관리자 발송·빈자리 알림 …) 각각에 발송 코드를 넣지 않는다. 롤백된 알림은 나가지 않는다. - connected 이벤트, 알림 id 를 이벤트 id 로, 25초 heartbeat, 30분 타임아웃, 사용자당 연결 5개 상한. - X-Accel-Buffering: no, 연결 수 게이지(carecode.notification.stream.connections). - 연결 종료 시 ASYNC 디스패치는 인가를 다시 하지 않는다 (JWT 필터가 돌지 않아 커밋된 응답에 401 을 쓰려던 문제). - docs/features/realtime-notifications.md
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.
Closes #45
이슈 할 일 대응
/notifications/**인증 규칙notification이벤트 = 알림 목록 항목과 같은 JSON,id= 알림 idconnected수신 시 목록 재조회(목록이 진실의 원천), 중복은 재조회라 무해, 연결 상한확인
NotificationStreamContractTest(실제 JWT·트랜잭션): 비로그인 401, 커밋된 알림은 받는 사람에게만, 롤백된 알림 미전송, 연결 상한한계
연결이 인스턴스 메모리에 있다. 현재 단일 인스턴스라 충분하고, 늘릴 때는 Redis pub/sub 가 필요하다 (문서에 기록).