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

[feat #95] 채팅 전송 웹소켓 API #96

Merged
merged 9 commits into from
Sep 1, 2024

Conversation

hyun2371
Copy link
Member

@hyun2371 hyun2371 commented Sep 1, 2024

관련 이슈

📑 작업 상세 내용

  • 웹소켓 구현
    • 내부 브로커 사용 -> 추후에 rabbitMQ나 kafka로 수정할 계획입니다.
    • apic에서 로컬로 테스트 진행했습니다.
    • cors 오류가 터져서 securityConfig를 수정했습니다.
  • chatMessage document 수정
    • mediaUrl을 없애고 content에 넣으면 될 것 같아서 해당 필드를 삭제했습니다.

💫 작업 요약

  • 웹소켓 구현
  • application.yml 환경별 분리, local 환경에서 rds 제거
  • chatMessage 테이블 수정

🔍 중점적으로 리뷰 할 부분

  • application.yml 환경별 분리
    • prod(배포), local용으로 분리
    • local에서는 mysql을 사용하도록 노션에 업데이트 했습니다.
  • 지금은 임시로 memberId를 request에 담아오도록 했습니다.
    • header에 token을 받거나 @AuthenticationPrincipal로 memberId를 받아오면 좋을 것 같아요
    • 저희 프로젝트에서도 이 방법으로 구현할 수 있을지 궁금합니다..

@hyun2371 hyun2371 added the ✨ feat 기능 추가 label Sep 1, 2024
@hyun2371 hyun2371 requested a review from dudxo September 1, 2024 08:23
@hyun2371 hyun2371 self-assigned this Sep 1, 2024
@hyun2371 hyun2371 linked an issue Sep 1, 2024 that may be closed by this pull request
4 tasks
Copy link

github-actions bot commented Sep 1, 2024

Code Coverage

Overall Project 83.32% -1.17% 🍏
Files changed 22.64%

File Coverage
ChatRoomService.java 100% 🍏
ChatRoomController.java 100% 🍏
ChatMessage.java 100% 🍏
ChatMessageService.java 10.26% -89.74%
ChatMessageController.java 0%

Copy link

github-actions bot commented Sep 1, 2024

Test Results

20 files  20 suites   14s ⏱️
96 tests 96 ✅ 0 💤 0 ❌
97 runs  97 ✅ 0 💤 0 ❌

Results for commit 16b6553.

Copy link
Collaborator

@dudxo dudxo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다!
인메모리 브로커, rabbitMQ, 소켓 관련 어노테이션(?)을 찾아보면서 코드를 읽었는데 신기하네요 ㅎㅎ
지난 번에 가현님께서 메시지 손실을 줄이고 싶다고 하셨는데 rabbitMQ || kafka로 수정해서 꼭 목표 달성하길 바랍니다!

memberId 관련해서 링크 걸어주신 블로그 글을 쭉 읽어봤습니다.
ChannelInterceptor 구현을 통해 웹소켓 연결 및 메시지에 대한 인증 처리를 진행하는 코드가 있고, 조금 더 아래(JpaConfig) 웹소켓과 별개로 동작하는 빈이어도 SecurityContextHolder에 Authentication이 저장되어 있으므로 따로 웹소켓을 위한 설정을 안해도 된다는 글이 있네요!

2번째 웹소켓과 별개로 동작하는 빈(SecurityContextHolder에 인증객체 저장)이 현재 저희가 인증 플로우에 쓰고 있는데, 이 방식이 있다면 ChannelInterceptor를 구현하지 않아도 되는건가 헷갈리네요,,

@@ -26,8 +26,6 @@ public class ChatMessage {

private Boolean isRead;

private String mediaUrl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediaUrl(사진, 동영상) 값을 content에 넣겠다는 말씀으로 이해했는데 맞을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 맞습니다!

@hyun2371
Copy link
Member Author

hyun2371 commented Sep 1, 2024

수고 많으셨습니다! 인메모리 브로커, rabbitMQ, 소켓 관련 어노테이션(?)을 찾아보면서 코드를 읽었는데 신기하네요 ㅎㅎ 지난 번에 가현님께서 메시지 손실을 줄이고 싶다고 하셨는데 rabbitMQ || kafka로 수정해서 꼭 목표 달성하길 바랍니다!

감사합니다..!

memberId 관련해서 링크 걸어주신 블로그 글을 쭉 읽어봤습니다. ChannelInterceptor 구현을 통해 웹소켓 연결 및 메시지에 대한 인증 처리를 진행하는 코드가 있고, 조금 더 아래(JpaConfig) 웹소켓과 별개로 동작하는 빈이어도 SecurityContextHolder에 Authentication이 저장되어 있으므로 따로 웹소켓을 위한 설정을 안해도 된다는 글이 있네요!

2번째 웹소켓과 별개로 동작하는 빈(SecurityContextHolder에 인증객체 저장)이 현재 저희가 인증 플로우에 쓰고 있는데, 이 방식이 있다면 ChannelInterceptor를 구현하지 않아도 되는건가 헷갈리네요,,

제가 security에 대해 깊게 공부해본적이 없어서 잘 모르겠어요,,, 일단 webSocketSecurityConfig는 추가해야 할 것 같긴 해요... 더 공부해보겠습니다

@hyun2371 hyun2371 merged commit e00ff80 into dev Sep 1, 2024
3 checks passed
@hyun2371 hyun2371 deleted the feat/#95/send-message-websocket branch September 1, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feat 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ 채팅 전송 웹소켓 API
2 participants