Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

실시간 알림 연동(SSE 사용) #162

Closed
jjaeho0415 opened this issue Mar 10, 2025 · 0 comments · Fixed by #172
Closed

실시간 알림 연동(SSE 사용) #162

jjaeho0415 opened this issue Mar 10, 2025 · 0 comments · Fixed by #172
Assignees
Labels
정재호 프론트담당 🚀 FEAT 기능 개발

Comments

@jjaeho0415
Copy link
Collaborator

jjaeho0415 commented Mar 10, 2025

SSE 연동 및 데이터 처리 시나리오

  1. 로그인 성공시 sse 연동을 해야하기 때문에 로그인 상태일때만 접속할 수 있는 페이지들을 감싸고 있는 ProtectedRoute.ts에 sse 구독 및 1시간마다 재연결하는 로직 작성
  2. 알림 목록을 받아오는(”/notification/list”) api는 react query로 작성한 후 protectedRoute.ts에서 호출(로그인하자마자 sse구독과 함께 바로 호출함)
  3. 받아온 알림 목록 데이터는 <Outlet context={{notifications, isLoading, error}}/>로 작성하여 하위 컴포넌트에 넘겨줌
  4. 알림 페이지내에서 const {notifications} = useOutletContext<{notifications: type}>()을 사용함으로써 protectedRoute.ts에서 넘겨준 알림 목록을 받아온 후 가공하여 화면에 표시
  5. 그룹 목록, 채팅목록 페이지의 헤더에서 알림 목록 중 read:false인 항목이 있으면 빨간점을 표시해줌
  6. sse 수신 데이터의 eventType에 따라 알맞는 쿼리키를 사용하여 쿼리 무효화를 해줌으로써 실시간으로 상호작용되도록 함
@jjaeho0415 jjaeho0415 self-assigned this Mar 10, 2025
@jjaeho0415 jjaeho0415 converted this from a draft issue Mar 10, 2025
@jjaeho0415 jjaeho0415 added 🚀 FEAT 기능 개발 정재호 프론트담당 labels Mar 10, 2025
jjaeho0415 added a commit that referenced this issue Mar 15, 2025
@jjaeho0415 jjaeho0415 linked a pull request Mar 16, 2025 that will close this issue
shuding0307 added a commit that referenced this issue Mar 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Feat: 알림 페이지 sse 실시간 연동
@github-project-automation github-project-automation bot moved this from 작업 진행중인 일 to 작업 완료 in PlanU-FE project Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
정재호 프론트담당 🚀 FEAT 기능 개발
Projects
Status: 작업 완료
Development

Successfully merging a pull request may close this issue.

1 participant