Skip to content

Conversation

@CodeVac513
Copy link
Collaborator

@CodeVac513 CodeVac513 commented Jan 7, 2025

🔨 테스크

chatgateway의 관심사 분리

  • 기존의 chatgateway에는 여러 책임이 있었습니다.

    • 소켓 연결 관리
    • 메세지 이벤트 핸들링
    • Redis에 메세지 저장
    • 날짜가 바뀌었을 때 보낼 시스템 메세지 핸들링
    • 클라이언트의 IP를 확인하고 이름 생성 혹은 저장된 이름 가져오기
    • 채팅 내역 불러오기
  • gateway는 소켓 연결 관리와 메세지 이벤트 핸들링, 2가지의 책임을 지도록 관심사를 분리했습니다.

  • 이렇게 함으로써 기존 코드보다 유지보수와 확장에 이점을 가질 수 있다고 생각했습니다.

  • 나중에 service 레이어도 비대해지면 Redis와 관련된 부분을 모두 추출하여, repository 계층으로 분리할 수 있을 것 같습니다.

📋 작업 내용

  • gateway 내부에서 비즈니스 로직을 모두 service 레이어로 추출
  • service 레이어로 추출하면서 메서드 이름, 접근 제한자 종류를 조금씩 수정했습니다.
    • ex) emitMidnightMessage 같은 메서드는 handleDateMessage로 수정, getIp는 클라이언트 이름 설정에만 쓰이기에 private 전환 등...

📷 스크린 샷(선택 사항)

스크린샷 2025-01-07 171256
스크린샷 2025-01-07 171311

@CodeVac513 CodeVac513 self-assigned this Jan 7, 2025
@CodeVac513 CodeVac513 added the 🔨 Refactor 리팩토링 (구조 변경) label Jan 7, 2025
Copy link
Member

@Jo-Minseok Jo-Minseok left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 궁금한 사안 하나 남겨뒀는데 확인 부탁드려요!

Copy link
Member

@asn6878 asn6878 left a comment

Choose a reason for hiding this comment

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

확인했습니다!
몇가지 질문사항 남겨두었으니 확인해주시면 감사하겠습니다 🙇

Copy link
Member

@asn6878 asn6878 left a comment

Choose a reason for hiding this comment

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

코멘트 답변해주셔서 감사합니다~ 고생하셨습니다 👍

Copy link
Member

@Jo-Minseok Jo-Minseok left a comment

Choose a reason for hiding this comment

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

확인했습니다! 고생하셨어요

@CodeVac513 CodeVac513 merged commit f872d6e into main Jan 8, 2025
1 check passed
@CodeVac513 CodeVac513 deleted the refactor/chatgateway-SoC branch January 8, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 리팩토링 (구조 변경)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants