diff --git a/mediaServer/src/RelayServer.ts b/mediaServer/src/RelayServer.ts index 7366e3a..805d314 100644 --- a/mediaServer/src/RelayServer.ts +++ b/mediaServer/src/RelayServer.ts @@ -64,15 +64,15 @@ export class RelayServer { this.clientsConnectionInfo.set(email, new ClientConnectionInfo(RTCPC)); this.roomsConnectionInfo.set(data.roomId, new RoomConnectionInfo(RTCPC)); socket.join(email); - await Promise.all([ - saveClientInfo(email, ClientType.PRESENTER, data.roomId), - saveRoomInfo(data.roomId, new RoomInfoDto(email, data.whiteboard)) - ]); if (roomInfo.presenterEmail !== email) { if (await isQuestionStreamExisted(data.roomId)) { await deleteQuestionStream(data.roomId); } await setQuestionStreamAndGroup(data.roomId); + await Promise.all([ + saveClientInfo(email, ClientType.PRESENTER, data.roomId), + saveRoomInfo(data.roomId, new RoomInfoDto(email, data.whiteboard)) + ]); } if (roomInfo.presenterEmail === email) { await sendDataToReconnectPresenter(email, data.roomId, roomInfo); diff --git a/mediaServer/src/services/client.service.ts b/mediaServer/src/services/client.service.ts index cb8b4ea..3776e02 100644 --- a/mediaServer/src/services/client.service.ts +++ b/mediaServer/src/services/client.service.ts @@ -17,7 +17,7 @@ const saveClientInfo = async (email: string, clientType: ClientType, roomId: str const sendDataToReconnectPresenter = async (email: string, roomId: string, roomInfo: Record) => { const unsolvedQuestions = (await findUnsolvedQuestions(roomId, email)) as StreamReadRaw; sendMessageUsingSocket('/create-room', email, 'reconnectPresenter', { - whiteboard: roomInfo.currentWhiteboardData, + whiteboard: JSON.parse(roomInfo.currentWhiteboardData), startTime: roomInfo.startTime, questions: unsolvedQuestions[0][1] });