Skip to content

Feature(#243): 발표자 재접속 시 미해결 질문 & 화이트보드 정보 & 강의 시작시간 전달 #253

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

Conversation

platinouss
Copy link
Member

@platinouss platinouss commented Dec 11, 2023

작업 개요

close #243 발표자 재접속 시 미해결 질문 & 최신 화이트보드 정보 & 강의 시작 시간을 전달한다.

작업 사항

  • 접속한 클라이언트가 현재 발표 중인 발표자인지 확인한다.
  • Redis에서 최신 화이트보드 정보 & 강의 시작 시간을 가져온다.
  • 해당 질문 stream의 보류 리스트(pending list)에서 ACK 요청을 받지 않은 모든 질문을 가져온다.
  • 해결되지 않은 질문 & 최신 화이트보드 정보 & 강의 시작시간을 발표자에게 전달한다.
  • 강의 종료 시, 해당 강의실 질문 stream key를 삭제한다.

고민한 점들(필수 X)

Redis를 사용하여 미디어 서버 역할 분리하기 문서의 기능 추가하기 챕터에 과정을 정리했습니다.

추가사항

재접속 한 발표자는 미디어 서버로부터 다음과 같은 메시지를 받습니다

/** 
* event: reconnectPresenter
*/

{
  "whiteboard": ${ICanvasData},  // 최근 화이트보드 데이터
  "startTime": ${Date}, // 강의 시작 시간
  "questions": []   // 배열 형태로 미해결 질문 전달
}

위 "questions"는 아래와 같은 형태로 들어오게 됩니다.

[
  [${questionId}, ['content', ${질문 내용}]]
]

ex) 4개의 질문이 들어온다면

[
  ['1702272218140-0', ['content', '질문 내용 테스트 1']],
  ['1702272218714-0', ['content', '질문 내용 테스트 2']],
  ['1702272219428-0', ['content', '질문 내용 테스트 3']],
  ['1702272221156-0', ['content', '질문 내용 테스트 4']]
]

발표자에게 질문 시 해당 질문 stream에 질문을 추가하고, 발표자가 해당 질문을 읽으면 ACK 요청을 보낸다.
혹여나 발표자 재접속 시 보류 리스트(pending list)의 질문을 전달한다.
@platinouss platinouss added ✨ Feat 기능 개발 BE 백엔드 작업 labels Dec 11, 2023
@platinouss platinouss added this to the 6주차 milestone Dec 11, 2023
@platinouss platinouss requested a review from tmddus2 December 11, 2023 07:13
@platinouss platinouss self-assigned this Dec 11, 2023
@boostcampwm2023 boostcampwm2023 deleted a comment from netlify bot Dec 11, 2023
@platinouss platinouss changed the title Feature(#243): 발표자 재접속 시 미해결 질문 & 화이트보드 정보 & 강의 시작시간을 전달 Feature(#243): 발표자 재접속 시 미해결 질문 & 화이트보드 정보 & 강의 시작시간 전달 Dec 11, 2023
@platinouss platinouss marked this pull request as draft December 11, 2023 08:49
@platinouss platinouss marked this pull request as ready for review December 11, 2023 11:31
Comment on lines +71 to +79
if (roomInfo.presenterEmail !== email) {
if (await isQuestionStreamExisted(data.roomId)) {
await deleteQuestionStream(data.roomId);
}
await setQuestionStreamAndGroup(data.roomId);
}
if (roomInfo.presenterEmail === email) {
await sendDataToReconnectPresenter(email, data.roomId, roomInfo);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 추가된 로직이 어떤 로직인가요? roomInfo.presenterEmail !== email 일때랑 roomInfo.presenterEmail === email는 조건문 하나 if-else로 합칠 수 있을 것 같아요

Comment on lines +212 to +213
const streamData = (await findQuestion(data.roomId, presenterEmail)) as StreamReadRaw;
const question = getStreamKeyAndQuestionFromStream(streamData);
Copy link
Collaborator

Choose a reason for hiding this comment

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

질문도 stream의 형태로 들어오나요??

Comment on lines +17 to +25
const sendDataToReconnectPresenter = async (email: string, roomId: string, roomInfo: Record<string, string>) => {
const unsolvedQuestions = (await findUnsolvedQuestions(roomId, email)) as StreamReadRaw;
sendMessageUsingSocket('/create-room', email, 'reconnectPresenter', {
whiteboard: roomInfo.currentWhiteboardData,
startTime: roomInfo.startTime,
questions: unsolvedQuestions[0][1]
});
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분 재접속한 사용자에게 현재 화이트보드 화면 정보를 알려주는 부분으로 이해했는데 맞을까요? 맞다면 재접속한 사용자와 처음 접속하는 사용자의 차이점? 같은게 있을까요?? 해당 로직들은 처음 들어온 사용자에게도 필요한 로직 같아서요!

Comment on lines +4 to +9
const sendMessageUsingSocket = (
namespace: string,
target: string,
eventName: string,
data: Record<string, string | Array<EntryRaw>>
) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이벤트가 많아져서 관리하기 쉽지 않으셨을거 같은데 이렇게 뺀거 좋은거 같아요!

@tmddus2 tmddus2 self-requested a review December 11, 2023 13:08
@tmddus2
Copy link
Collaborator

tmddus2 commented Dec 11, 2023

해당 질문 stream의 보류 리스트(pending list)에서 ACK 요청을 받지 않은 모든 질문을 가져온다. 에서 ACK 라는게 뭔가요? 네트워크에서 나오는 그 ACK 일까요??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 작업 ✨ Feat 기능 개발
Projects
None yet
2 participants