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/67] 매칭 실패 로직 #68

Merged
merged 3 commits into from
Sep 3, 2024
Merged

[Feat/67] 매칭 실패 로직 #68

merged 3 commits into from
Sep 3, 2024

Conversation

rimi3226
Copy link
Contributor

@rimi3226 rimi3226 commented Sep 3, 2024

🚀 개요

매칭 실패 로직 구현했습니다

🔍 변경사항

  • 매칭 다시하기 버튼 누르면 매칭 실패 로직

⏳ 작업 내용

  • client 측 socket emit, socket on
  • 3000번 로직 구현

📝 논의사항

  • 매칭 실패 시 3000번 로직
    26) 매칭 FAIL API 요청
    27) 상대 client에게 matching-fail emit
    28) socket.target 제거
    29) otherSocket.matchingTarget 제거

@rimi3226 rimi3226 requested a review from Eunjin3395 September 3, 2024 14:40
@rimi3226 rimi3226 self-assigned this Sep 3, 2024
@rimi3226 rimi3226 linked an issue Sep 3, 2024 that may be closed by this pull request
2 tasks
@rimi3226 rimi3226 removed a link to an issue Sep 3, 2024
2 tasks
@rimi3226 rimi3226 linked an issue Sep 3, 2024 that may be closed by this pull request
2 tasks
Comment on lines 141 to 153
const otherSocket = await getSocketIdByMemberId(io, socket.matchingTarget);

// 26) 매칭 FAIL API 요청
await updateBothMatchingStatusApi(socket,"FAIL",socket.matchingTarget);

// 27) 상대 client에게 matching-fail emit
emitMatchingFail(otherSocket);

// 28) socket.target 제거
socket.matchingTarget=null;

// 29) otherSocket.matchingTarget 제거
otherSocket.matchingTarget=null;
Copy link
Member

Choose a reason for hiding this comment

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

이 부분이 제가 다른 기능 구현할 때도 그랬었는데,, getSocketIdByMemberId를 할 때 찯을 대상 소켓이 disconnect된 경우에는 아예 여기서 소켓을 찾지 못하더라구요..! 그래서 otherSocket에 대한 null 여부를 체크하고 그 아래 줄부터 실행해야 오류가 안났었습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헉 그렇군요!! 알겠습니다. 수정하겠습니당!

Copy link
Member

@Eunjin3395 Eunjin3395 left a comment

Choose a reason for hiding this comment

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

getSocketIdByMemberId 결과 값 null 체크만 추가해주시면 될 것 같아요 고생하셨습니다!

@rimi3226
Copy link
Contributor Author

rimi3226 commented Sep 3, 2024

getSocketIdByMemberId 결과 값 null 체크만 추가해주시면 될 것 같아요 고생하셨습니다!

넵! 수정하겠습니다!

@rimi3226 rimi3226 merged commit ca16e4c into develop Sep 3, 2024
@rimi3226 rimi3226 deleted the feat/67 branch September 3, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ [Feat] matching-fail 로직 구현
2 participants