Skip to content

Fix: [BADA-363] SSE 연결 오류 수정#389

Merged
choyunju merged 1 commit intodevelopfrom
fix/BADA-363-fix-sse-connection
Aug 5, 2025
Merged

Fix: [BADA-363] SSE 연결 오류 수정#389
choyunju merged 1 commit intodevelopfrom
fix/BADA-363-fix-sse-connection

Conversation

@choyunju
Copy link
Copy Markdown
Contributor

@choyunju choyunju commented Aug 5, 2025

#️⃣연관된 이슈

close: #386

🚀 작업 내용

  • SSE 연결 응답 값을 JSON으로 포맷 변환

🔍 리뷰 요청 사항

@choyunju choyunju added this to the 🚨 SOS milestone Aug 5, 2025
@choyunju choyunju self-assigned this Aug 5, 2025
@choyunju choyunju added the 🐞 BugFix Something isn't working label Aug 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 5, 2025

Failed to generate code suggestions for PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 5, 2025

Walkthrough

이번 변경 사항에서는 SOS 도메인에서 서버-센트 이벤트(SSE) 통신에 사용되는 메시지 구조를 개선하였습니다. 새로운 DTO 클래스인 ConnectSseResponse가 도입되어, SOS 요청 및 응답 시 기존의 단순 문자열 메시지 대신 구조화된 객체 형태로 데이터를 전달하도록 변경되었습니다. 이를 위해 SosService의 메시지 전송 로직이 DTO를 사용하도록 수정되었고, SseServicesendToClientbroadcast 메서드의 파라미터 타입이 각각 ObjectConnectSseResponse로 변경되었습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e66000 and 854b620.

📒 Files selected for processing (3)
  • src/main/java/com/TwoSeaU/BaData/domain/sos/dto/response/ConnectSseResponse.java (1 hunks)
  • src/main/java/com/TwoSeaU/BaData/domain/sos/service/SosService.java (3 hunks)
  • src/main/java/com/TwoSeaU/BaData/global/sse/SseService.java (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#132
File: src/main/java/com/TwoSeaU/BaData/domain/user/dto/response/GetFollowsResponse.java:25-25
Timestamp: 2025-07-17T13:03:43.601Z
Learning: choyunju prefers intuitive field naming in DTOs - even if the API response could use generic names like "username", they prefer to use descriptive field names like "nickname" that clearly indicate the actual data being returned for better code clarity and maintainability.
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#267
File: src/main/java/com/TwoSeaU/BaData/domain/user/controller/UserController.java:151-154
Timestamp: 2025-07-28T01:13:39.883Z
Learning: choyunju는 프론트엔드에서 토글 형식으로 구현된 Boolean 파라미터의 경우, null 값이 들어올 수 없다고 판단하여 별도의 null 검증 로직을 추가하지 않는 것을 선호한다. 프론트엔드와 백엔드 간의 계약이 명확할 때 중복 검증을 피하는 설계 접근법을 취한다.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (10)
src/main/java/com/TwoSeaU/BaData/domain/sos/service/SosService.java (3)

8-8: 새로운 DTO import 추가 승인

ConnectSseResponse DTO를 위한 import가 적절하게 추가되었습니다. 이는 SSE 응답을 구조화된 형태로 전송하기 위한 변경사항과 일치합니다.


50-51: SOS 요청 시 구조화된 응답으로 개선

기존의 단순 문자열 메시지 대신 ConnectSseResponse DTO를 사용하여 SSE 메시지를 전송하도록 변경되었습니다. 이는 프론트엔드에서 SSE 메시지를 JSON으로 파싱할 수 있게 하여 PR 목표를 달성합니다.


66-67: SOS 응답 시 구조화된 응답으로 개선

respondSos 메서드에서도 구조화된 ConnectSseResponse 객체를 사용하여 SSE 메시지를 브로드캐스트하도록 변경되었습니다. 이는 일관성 있는 SSE 메시지 형식을 제공합니다.

src/main/java/com/TwoSeaU/BaData/domain/sos/dto/response/ConnectSseResponse.java (3)

13-17: Lombok 어노테이션 사용이 적절함

Builder 패턴과 protected 접근 제어자를 사용한 생성자 설계가 잘 되어 있습니다. 불변 객체 생성을 위한 적절한 구조입니다.


18-22: 필드명이 직관적이고 명확함

필드명이 각각의 용도를 명확하게 나타내고 있어 코드 가독성이 좋습니다. 이전 학습 내용에 따르면 choyunju님이 선호하는 직관적인 필드명 스타일과 일치합니다.


24-32: 정적 팩토리 메서드 구현이 우수함

Sos 엔티티에서 필요한 정보를 추출하여 DTO를 생성하는 로직이 잘 구현되어 있습니다. 특히 28번 라인에서 responder가 null일 경우를 적절히 처리하고 있습니다.

src/main/java/com/TwoSeaU/BaData/global/sse/SseService.java (4)

12-12: 필요한 DTO import 추가 승인

ConnectSseResponse DTO를 사용하기 위한 import가 적절하게 추가되었습니다.


43-43: sendToClient 메서드 파라미터 타입 개선

파라미터 타입을 String에서 Object로 변경하여 더 유연한 데이터 전송이 가능해졌습니다. 이는 구조화된 객체뿐만 아니라 기존의 문자열 메시지도 지원할 수 있게 합니다.


59-59: broadcast 메서드 타입 안전성 향상

파라미터 타입을 String에서 ConnectSseResponse로 구체화하여 타입 안전성이 향상되었습니다. 이는 SSE 브로드캐스트에서 일관된 데이터 구조를 보장합니다.


65-65: 구조화된 객체 전송으로 개선

기존의 단순 문자열 대신 ConnectSseResponse 객체를 전송하도록 변경되어, 프론트엔드에서 JSON 형태로 메시지를 파싱할 수 있게 되었습니다. 이는 PR의 핵심 목표를 달성합니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/BADA-363-fix-sse-connection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 5, 2025

Overall Project 17.78% -0.18%
Files changed 0%

File Coverage
SseService.java 0% -5.65%
SosService.java 0% -14.68%

@choyunju choyunju merged commit d5bb4eb into develop Aug 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BADA-363] [BUG] SSE 연결 접속 오류 해결

2 participants