Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions backend/socket/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:16.18.1

WORKDIR /app

COPY yarn.lock package.json ./
RUN yarn install

COPY . .
RUN yarn build

CMD yarn start
2 changes: 1 addition & 1 deletion backend/socket/src/room/room.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class RoomGateway implements OnGatewayConnection, OnGatewayDisconnect {

@SubscribeMessage(EVENT.END_INTERVIEW)
handleEndInterview(@ConnectedSocket() client: Socket) {
return this.interviewService.endInterview(client);
return this.interviewService.endInterview({ client, server: this.server });
}

@SubscribeMessage(EVENT.END_FEEDBACK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class InterviewService {
return {};
}

endInterview(client: Socket) {
endInterview({ client, server }: { client: Socket; server: Namespace }) {
const docsUUID = uuidv4();

const user = this.roomRepository.getUserByClientId(client.id);
Expand All @@ -52,7 +52,7 @@ export class InterviewService {
const clientId = this.roomRepository.getClientIdByUser(user.uuid);

const emitEvent = this.getEventAtEndInterviewByRole(user.role);
client.to(clientId).emit(emitEvent, { docsUUID });
server.to(clientId).emit(emitEvent, { docsUUID });
Copy link
Member

Choose a reason for hiding this comment

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

client socket에서는 자기 자신의 소켓이 제외되어 broadcast를 해도 event가 오지 않는거였군요

});

// TODO video object storage upload
Expand Down
1 change: 1 addition & 0 deletions backend/socket/src/room/service/webRTC/webrtc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class WebrtcService {

disconnectWebrtc(client: Socket) {
const user = this.roomRepository.getUserByClientId(client.id);
if (!user) return;

client.to(user.roomUUID).emit(EVENT.DISCONNECT_WEBRTC, { userUUID: user.uuid });
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"scripts": {
"start": "craco start",
"build": "craco build",
"build": "CI=false && craco build",
"test": "craco test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/pages/Lobby/Lobby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const Lobby = () => {
const streamList = useRecoilValue(webRTCStreamSelector);

useEffect(() => {
//TODO 변경된 부분 BE랑 맞추기
socket.on(SOCKET_EVENT_TYPE.JOIN_INTERVIEW, ({ user: interviewee }) => {
const newOthers = others.map((user) => {
return user.uuid === interviewee.uuid
Expand Down Expand Up @@ -61,12 +60,10 @@ const Lobby = () => {
}, [others]);

useEffect(() => {
//TODO Lobby 첫 렌더링 시가 아니라 첫 입장 시만 하기
startConnection(me.uuid);
if (!webRTCUserList.has(me.uuid)) startConnection(me.uuid);
Copy link
Member Author

Choose a reason for hiding this comment

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

key뿐만 아니라 value까지 체크하면 stream이 끊겼을 때 signaling 과정을 다시 거쳐서 stream을 살릴 수도 있을 거 같네요

Copy link
Member

Choose a reason for hiding this comment

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

일단은 이렇게 진행하고 나중에 생각해보는걸로 합시다.

}, []);

const handleStartInterviewee = async () => {
//TODO 변경된 부분 BE랑 맞추기
await socketEmit<joinInterviewResponseType>(SOCKET_EVENT_TYPE.START_INTERVIEW);

const newOthers = others.map((user) => {
Expand Down