HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
♥️
2기 최종 프로젝트 팀별 공간
/
🌳
[팀 05] Forest
/
🪐
BE WorkSpace
/
🗯️
API 명세
/
✅
/api/v1/connection/sse
✅

/api/v1/connection/sse

HTTP 메서드
GET
contents-type
"text/event-stream"
비고
client - server 이벤트 스트림 얻기
연관된 페이지
속성
⏳ 유저 스토리
기본 timeout 시간 30분

[ Description ]

  • 서버와 실시간 SSE 통신 이벤트 스트림 요청

[ Request]

Header
Name
Type
Description
비고
Authorization
String
인증 토큰

알림 매커니즘

  1. 인증(로그인) 후 /api/v1/connection/sse 호출하여 서버랑 연결 (front → server)
  1. 연결 성공하면 health-check 이벤트 발행 (server → front)
  1. 연결이 되어있는 동안 알림 발생 시 notification-occur 이벤트로 전송 (server → front)
  1. notification-occur 이벤트 발생하면 알림 아이콘에 숫자 뱃지 띄우기
eventSource.addEventListener("health-check", function (event) { //연결 재대로 되어있는지 확인하는 용도 console.log(event.data); const data = JSON.parse(event.data); } eventSource.addEventListener("notification-occur", function (event) { //알림 아이콘에 숫자 띄우기? 매트의 영역! }
 
  1. 알림 아이콘을 클릭 하면 알림 조회 화면으로 이동(/api/notifications 호출)
notification 응답
{ content : {[ { id : 1, ridingId : 2, type : "RIDING_JOIN", content : "'우리 같이 라이딩해요!' 라이딩에 새로운 라이더가 참가했어요!" }, ]} pageable : { ... 페이지 정보 } }