-
Notifications
You must be signed in to change notification settings - Fork 3
[feat] SSE 알림 기능 구현 #29
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
Conversation
- 이벤트 타입 정의 enum 추가 - 이벤트 전달 객체 추가(RoomCreatedEvent, RoomUpdatedEvent, RoomDeletedEvent)
- 이벤트 타입 별 SSE 본문 객체 추가
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[L1-변경요청]
강현님 PR 제목 수정 부탁드립니닷 !
sehee123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다. SSE.. ⭐️
jiwon1217
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 ! listener 패키지에 이벤트 타입마다 EventListener 클래스를 만드신 이유가 궁금합니다.
이벤트 하나하나가 단순해서 하나로 합칠수 있긴한데, 이벤트 타입의 관점에서 srp를 생각하면서 작성했습니다! |
|
PR 설명에서
이 부분에서 궁금한 건데, emitter 객체가 오래 유지되는 경우는 그럼 사용자가 로비에서 오래 머무를 때를 얘기하는 거죠? |
backend/src/main/java/io/f1/backend/domain/game/sse/dto/LobbySseEvent.java
Show resolved
Hide resolved
backend/src/main/java/io/f1/backend/domain/game/sse/dto/RoomCreatedPayload.java
Show resolved
Hide resolved
넵 맞습니다! |
silver-eunjoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헐 짱 어려운데.. 너무 설명을 잘해주셔서 이해해버렸어요..
감사합니다 !! 고생하셨습니다 👍
🛰️ Issue Number
Closes #18
🪐 작업 내용
SSE 연결 종료 및 객체 정리 설명
이번 작업내용은 아니지만, emitter 객체 해제의 경우는 주석으로 적기에는 조금 길어서 이 부분에 적어두었습니다.
SSE 플로우
Room의 생성, 수정, 삭제 메서드에서는 각 작업이 완료된 후, 해당 작업에 대응하는 이벤트 객체(RoomCreatedEvent, RoomUpdatedEvent, RoomDeletedEvent)를 발행합니다.
이 이벤트들은 SseMapper를 통해 LobbySseEvent로 변환되며, 이 과정에서 이벤트 타입(CREATE, UPDATE, DELETE)이 지정되고, 클라이언트에게 전달할 payload가 구성됩니다.
변환된 LobbySseEvent는 이벤트 리스너를 통해 SSE(로비에 있는 사용자)를 구독 중인 모든 클라이언트에게 브로드캐스팅됩니다.
변경 사항
테스트 사진
아래는 security 설정을 모두 끄고, 생성 SSE 메시지 알림 테스트 해보았습니다. 정상적으로 알림을 받는 것을 확인할 수 있습니다.

📚 Reference
✅ Check List