Skip to content

Commit

Permalink
error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
16BitNarwhal committed Aug 29, 2024
1 parent e2013a7 commit 9f692fb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/src/pages/MeetingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ const MeetingPage = () => {
newSocket.emit('join', { meeting_id: meeting_id, username: username });
});

chatHandler.current = new ChatHandler(meeting_id, username, socketRef.current, setChatHistory);
const errorHandler = (error) => {
console.error(error);
navigate('/');
toast.error(error.message);
}

chatHandler.current = new ChatHandler(meeting_id, username, socketRef.current, setChatHistory, errorHandler);
chatHandler.current.initialize();
const handlePeerUpdate = (update) => {
setPeers(prevPeers => ({...prevPeers, ...update}));
console.debug('Updated peers:', peers);
}
rtcHandler.current = new RTCHandler(meeting_id, username, socketRef.current, handlePeerUpdate);
rtcHandler.current = new RTCHandler(meeting_id, username, socketRef.current, handlePeerUpdate, errorHandler);
rtcHandler.current.initialize();

return () => {
rtcHandler.current.cleanup();
socketRef.current.disconnect();
Expand Down

0 comments on commit 9f692fb

Please sign in to comment.