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

채팅 기능 #71

Open
7 of 11 tasks
JunBe opened this issue Feb 8, 2025 · 0 comments · May be fixed by #76
Open
7 of 11 tasks

채팅 기능 #71

JunBe opened this issue Feb 8, 2025 · 0 comments · May be fixed by #76
Assignees

Comments

@JunBe
Copy link
Member

JunBe commented Feb 8, 2025

📄 설명

실시간 채팅 기능을 WebSocket을 사용하여 구현합니다.

✅ 작업할 내용

  • WebSocket 설정
  • 채팅방 생성
  • 메시지 전송
  • 구독
  • 채팅방 목록 조회
  • 특정 채팅방 내용 조회
  • 읽음 / 안읽음 처리
  • 채팅방 나가기
  • 이미지 / 파일 전송
  • 메시지 검색
  • 채팅 알림
@JunBe JunBe self-assigned this Feb 13, 2025
JunBe added a commit that referenced this issue Feb 14, 2025
- WebSocket 의존성 추가

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- WebSocketConfig
 - STOMP WebSocket 엔드포인트 "/ws" 설정
 - 메시지 전송 시 엔드포인트 "/app" prefix 설정
 - 메시지 받을 시 엔드포인트 "/topic" prefix 설정

- PathConst
 - 로그인 없이 접근 가능하도록 웹 소켓 관련 경로 임시 허용

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
JunBe added a commit that referenced this issue Feb 14, 2025
JunBe added a commit that referenced this issue Feb 14, 2025
- /api/chat/room 엔드포인트로 채팅방을 생성
 - 채팅방은 상품 id, 판매자 id, 구매자 id를 조합하여 구분
- /api/chat/room/{userId} 엔드포인트로 채팅방 조회
 - {userId}에 해당하는 구매자, 판매자의 채팅방을 전부 조회

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
JunBe added a commit that referenced this issue Feb 14, 2025
JunBe added a commit that referenced this issue Feb 14, 2025
- ChatMessageController
 - @MessageMapping을 통해 해당 엔드포인트에 메시지 전송 후 로직 처리
 - @sendto를 통해 해당 엔트포인트를 구독하고 있는 사용자에게 처리된 메시지 전송

- ChatMessageService
 - 방 번호, 유저 id null 여부 검사 후 예외 처리
 - ChatMessageRequest를 통해 받은 메시지 정보 DB에 저장

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- 기존 ChatRoom 데이터를 전부 반환하던 로직을 ChatRoomResponse DTO를 생성하여 필요한 정보만 반환하도록 변경

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- WebSocket 관련 메시지 Controller ChatMessageWebSocketController로 이름 변경
- Rest API 구현 메시지 Controller는 ChatMessageController에 구현

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- roomId를 통해 채팅방의 전체 메시지를 조회
- 기본으로 10개의 메시지가 조회되고, 첫 페이지 로드
- 메시지는 최신순으로 조회

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- 공통으로 `/api/chat/room`를 사용하도록 변경

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- 특정 유저가 속해 있는 채팅방 조회시 반환되는 최신 메시지 필드에 오래된 메시지가 반환되어 최신 메시지 반환하도록 수정

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- ChatRoom의 전체 데이터가 응답으로 반환되어 ChatRoomResponse DTO를 사용하여 필요한 값만 반환하도록 변경

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- Product, User 객체를 받는 필드 productId -> product, buyerId -> buyer, sellerId -> seller로 변경

- 필드명에 맞춰 Repository 수정

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- 중복되는 로직을 chatRoomResponseEntity 메서드로 만들어 각 가능에서 메서드를 사용하도록 변경

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- 구독자 관리용 Entity 생성
- 채팅방 생성시 판매자, 구매자는 해당 채팅방을 자동으로 구독

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- @sendto는 현재 구독중인 유저에게만 메시지 전송
- 앱 재시작 시 구독중인 유저 상태가 모두 해제되어 DB에 저장되어 있는 구독자에게 모두 메시지 전송하도록 구현

Resolves: #71
JunBe added a commit that referenced this issue Feb 14, 2025
- ResponseEntity와 ApiResponse를 사용하여 응답 값을 반환하도록 변경

Resolves: #71
@JunBe JunBe linked a pull request Feb 14, 2025 that will close this issue
2 tasks
@JunBe JunBe linked a pull request Feb 14, 2025 that will close this issue
2 tasks
JunBe added a commit that referenced this issue Feb 17, 2025
- ChatFile 엔티티 생성
- 파일 전송시 해당 데이터들을 관리

Resolves: #71
JunBe added a commit that referenced this issue Feb 17, 2025
- Request
 - 전송자 ID, 파일 URL

- Response
 - 방 번호, 프리사인 URL, 파일 타입

Resolves: #71
JunBe added a commit that referenced this issue Feb 17, 2025
- 파일 전송 엔드포인트 `/chat/{roomId}/sendFile` 추가

Resolves: #71
JunBe added a commit that referenced this issue Feb 17, 2025
- 확장자 명을 파싱하여 파일 타입으로 반환

Resolves: #71
JunBe added a commit that referenced this issue Feb 17, 2025
- ChatFileRequest를 통해 받은 파일 URL 리스트를 통해 파일 타입과 프리사인 URL을 생성하여 응답으로 반환

Resolves: #71
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 a pull request may close this issue.

1 participant