feat: 알림 실시간 수신 (SSE 클라이언트) - #94
Merged
Merged
Conversation
서버 GET /notifications/stream 에 연결해 새 알림이 오면 알림 목록·배지를 다시 불러온다. - EventSource 는 Authorization 헤더를 못 붙이므로(토큰은 메모리에만 있다) fetch 스트림으로 읽는다. - SseParser: 조각난 네트워크 입력을 이벤트 단위로 모은다. heartbeat 주석은 건너뛴다. - 이벤트 내용을 캐시에 끼워 넣지 않고 목록을 다시 불러온다 — 끊긴 사이의 알림도 connected 때 채워지고, 같은 알림을 두 번 받아도 두 번 보이지 않는다. - 끊기면 1초부터 최대 30초까지 늘려 가며 재연결. 로그인 전에는 연결하지 않는다.
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 #93
서버: CareCode-Repo/CareCode_Interface#117 (서버 PR 을 먼저 배포해야 연결된다. 서버가 없으면 404 로 실패하고 30초 간격으로 재시도만 한다 — 화면에는 영향 없음)
변경
apis/notificationStream.ts— fetch 스트림 +SseParserNotificationStreamListener— 루트 레이아웃에 마운트, 이벤트 수신 시notificationQueries무효화, 지수 백오프 재연결테스트
notificationStream.test.ts— 서버가 실제로 보낸 바이트(로컬 Tomcat 에서 캡처)로 파싱, 7바이트 조각 입력, CRLF·공백