Skip to content

Commit 427b044

Browse files
authored
Merge pull request #102 from nicolelim02/feat/communication
Close communication socket when user ends session
2 parents 920dd80 + 3ca60ea commit 427b044

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

frontend/src/contexts/CollabContext.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { useReducer } from "react";
1616
import { updateQnHistoryById } from "../reducers/qnHistoryReducer";
1717
import qnHistoryReducer, { initialQHState } from "../reducers/qnHistoryReducer";
1818
import { CollabEvents, collabSocket, leave } from "../utils/collabSocket";
19-
import { CommunicationEvents } from "../components/Chat";
2019
import { communicationSocket } from "../utils/communicationSocket";
2120
import useAppNavigate from "../components/UseAppNavigate";
2221

@@ -131,16 +130,7 @@ const CollabProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
131130
leave(partner?.id as string, getMatchId() as string, true);
132131

133132
// Leave chat room
134-
communicationSocket.emit(
135-
CommunicationEvents.LEAVE,
136-
getMatchId(),
137-
matchUser?.username
138-
);
139-
communicationSocket.emit(
140-
CommunicationEvents.LEAVE,
141-
getMatchId(),
142-
partner?.username
143-
);
133+
communicationSocket.disconnect();
144134

145135
// Delete match data
146136
stopMatch();

0 commit comments

Comments
 (0)