Correction socket

This commit is contained in:
NouhailaAater 2025-02-22 02:04:49 -05:00
parent c9b76df2cd
commit 9286fe6b9c
2 changed files with 20 additions and 10 deletions

View file

@ -17,6 +17,7 @@ describe('StudentWaitPage Component', () => {
launchQuiz: jest.fn(), launchQuiz: jest.fn(),
roomName: 'Test Room', roomName: 'Test Room',
setQuizMode: jest.fn(), setQuizMode: jest.fn(),
setIsRoomSelectionVisible: jest.fn()
}; };
test('renders StudentWaitPage with correct content', () => { test('renders StudentWaitPage with correct content', () => {
@ -39,5 +40,4 @@ describe('StudentWaitPage Component', () => {
expect(screen.getByRole('dialog')).toBeInTheDocument(); expect(screen.getByRole('dialog')).toBeInTheDocument();
}); });
});
})

View file

@ -201,6 +201,16 @@ const ManageRoom: React.FC = () => {
webSocketService.launchStudentModeQuiz(roomName, quizQuestions); webSocketService.launchStudentModeQuiz(roomName, quizQuestions);
} }
}); });
socket.on('join-failure', (message) => {
setConnectingError(message);
setSocket(null);
});
socket.on('user-disconnected', (userId: string) => {
console.log(`Student left: id = ${userId}`);
setStudents((prevUsers) => prevUsers.filter((user) => user.id !== userId));
});
}; };
if (rooms.length === 0) { if (rooms.length === 0) {