Skip to content

Conversation

@sehee123
Copy link
Collaborator

@sehee123 sehee123 commented Jul 14, 2025

🛰️ Issue Number

close #6

🪐 작업 내용

흐름

입장 버튼 클릭 시

  • validation 체크 -> 웹소켓 연결 -> 구독 -> 입장 요청

validation 체크

  • 비밀방일 경우 비밀번호 체크
  • 게임중인지 여부
  • 정원 초과 여부
image 성공 시 roomId return

enter 로직 생성 (입장 요청 시 실행되는 흐름 )

  • RoomSetting, GameSetting,PlayerList 응답
image

웹소켓 연결

  • 웹소켓 인터셉터 구현-> 클라이언트 측 command 분기처리

웹소켓 dto interface 생성

  • WebSocketDto(구현체 - DefaultWebSocketResponse)
  • type은 Enum으로 관리할 수 있게 enum 생성
  • messageSendr에서 응답
 messagingTemplate.convertAndSend(destination,
            new DefaultWebSocketResponse<>(type, message));

⚠️ ws-test.html , ws-html.js 파일은 테스트용으로 웹소켓 구현 끝나면 삭제 예정입니다.

📚 Reference

https://docs.spring.io/spring-framework/reference/web/websocket/stomp/interceptors.html
https://github.com/spring-guides/gs-messaging-stomp-websocket/blob/main/complete/src/main/resources/static/app.js

✅ Check List

  • 코드가 정상적으로 컴파일되나요?
  • 테스트 코드를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

sehee123 and others added 5 commits July 14, 2025 01:23
# Conflicts:
#	backend/src/main/java/io/f1/backend/domain/game/api/RoomController.java
#	backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java
#	backend/src/main/java/io/f1/backend/domain/game/mapper/RoomMapper.java
#	backend/src/main/java/io/f1/backend/domain/game/store/RoomRepository.java
#	backend/src/main/java/io/f1/backend/domain/game/store/RoomRepositoryImpl.java
@sehee123 sehee123 linked an issue Jul 14, 2025 that may be closed by this pull request
4 tasks
@sehee123 sehee123 added the enhancement New feature or request label Jul 14, 2025
sehee123 and others added 3 commits July 14, 2025 11:41
# Conflicts:
#	backend/src/main/java/io/f1/backend/domain/game/api/RoomController.java
#	backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java
#	backend/src/main/java/io/f1/backend/domain/game/dto/response/RoomValidationResponse.java
@AllArgsConstructor
public class DefaultWebSocketResponse<T> implements WebSocketDto<T> {
private final MessageType type;
private final T message;
Copy link
Collaborator

Choose a reason for hiding this comment

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

바로 WebSocketDto를 클래스로 사용하지 않고, 이를 implement 하는 식으로 구현한 이유가 궁금합니다 ! 추후에 확장 가능성이 있는 건가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

우선은 WebSocket으로 주고받는 응답은 반드시 type과 message라는 구조를 가져야 한다는 의도를 명확히 하기 위해서 인터페이스로 분리했습니다.

추후에 확장 가능성을 생각할 때도 interface로 강제해두면 이후 응답 형태가 늘어나도 일관된 구조를 유지할 수 있다는 점에서 인터페이스를 설계하였습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

옹 ! 이해했습니다. 답변 감사합니다 ! :)

Copy link
Collaborator

@silver-eunjoo silver-eunjoo 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
Collaborator

@LimKangHyun LimKangHyun left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@sehee123 sehee123 merged commit 9598683 into dev Jul 14, 2025
2 checks passed
@sehee123 sehee123 deleted the feat/6 branch July 14, 2025 03:16
@sehee123 sehee123 self-assigned this Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 게임방 입장

6 participants