Skip to content

[Feat] SSE 실시간 이벤트 확장 - 질문 등록, 이해도 체크 생성/응답 이벤트 추가#143

Merged
kkw610 merged 1 commit into
developfrom
feat/#142
May 31, 2026
Merged

[Feat] SSE 실시간 이벤트 확장 - 질문 등록, 이해도 체크 생성/응답 이벤트 추가#143
kkw610 merged 1 commit into
developfrom
feat/#142

Conversation

@kkw610

@kkw610 kkw610 commented May 31, 2026

Copy link
Copy Markdown
Collaborator

#️⃣연관된 이슈

#142

📝작업 내용

기존에 댓글 생성 시에만 발행되던 SSE 이벤트를 질문 등록, 이해도 체크 생성/응답까지 확장

QuestionResDTO.java

이벤트 전용 record 3개 추가

  • QuestionCreatedEvent: 질문 등록 시 SSE로 전파되는 데이터
  • UnderstandingCheckCreatedEvent: 이해도 체크 생성 시 SSE로 전파되는 데이터
  • UnderstandingResponseUpdatedEvent: 이해도 O/X 응답 시 전체 카운트 전파

QuestionEventService.java

  • 기존 publishCommentCreated()의 중복 전송 로직을 broadcast()로 추출
  • publishQuestionCreated(), publishUnderstandingCheckCreated(), publishUnderstandingResponseUpdated() 추가

QuestionService.java

  • createQuestion(): 저장 후 publishQuestionCreatedEventAfterCommit() 호출
  • createUnderstandingCheck(): 저장 후 publishUnderstandingCheckCreatedEventAfterCommit() 호출
  • respondUnderstandingCheck(): 응답 처리 후 publishUnderstandingResponseUpdatedEventAfterCommit() 호출
  • 3개 모두 기존 댓글 이벤트와 동일하게 트랜잭션 커밋 이후에 발행 (롤백 시 오발행 방지)

application.yml

  • SSE 연결은 Tomcat 스레드를 점유하므로 max: 200, min-spare: 20으로 명시적 설정

참고 사항

  • 프론트엔드에서 EventSource 또는 fetch 기반 SSE 클라이언트로 /api/sessions/{sessionId}/questions/events를 구독하면 4가지 이벤트를 수신할 수 있음
  • JWT 인증이 필요한 엔드포인트이므로 프론트는 기본 EventSource 대신 fetch 기반 SSE 클라이언트를 사용해야 함

Closes #142

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
piro-in Ready Ready Preview, Comment May 31, 2026 11:11am
piro-in-765d Ready Ready Preview, Comment May 31, 2026 11:11am

@kkw610 kkw610 merged commit 6c79e84 into develop May 31, 2026
4 checks passed
@kkw610 kkw610 deleted the feat/#142 branch May 31, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] SSE 실시간 이벤트 확장 - 질문 등록, 이해도 체크 생성/응답 이벤트 추가

1 participant