Closed Priyanshu-2005 closed 1 month ago
Someone is attempting to deploy a commit to the dunsin's projects Team on Vercel.
A member of the Team first needs to authorize it.
Thanks @Dun-sin for accepting the changes.
It took a while to implement websocket to close the chat on button click Close Chat
. But it was a great learning.
Also Kindly label my PR as hacktoberfest-accepted
Fixes Issue
@Dun-sin My PR closes #677
👨💻 Changes proposed(What did you do ?)
Added a button
Close Chat
withonClick
functionality to trigger a function calldoCloseChat()
which further emits a socket request from client side for eventNEW_EVENT_CLOSE
which further callsemitClose()
function .The
emitClose
function is responsible for handling the closure of a chat. If an error occurs while closing, it alerts the user; otherwise, it either closes the current chat or navigates the user back to the homepage, depending on whether the chat was successfully closed. TheclearTimer
function is called to stop any running timers. It further calls thecloseChat()
function.The server listens to the request and broadcasts socket request from server side for event
NEW_EVENT_CLOSE
which calls a functiononClose
to notify the other person (who has not closed the chat) that the chat room has been closed.✔️ Check List (Check all the applicable boxes)
Note to reviewers
📷 Screenshots
Screencast from 07-10-24 10:15:20 PM IST.webm
Client A and B searching for a buddy.
Both connected now
Both are able to chat
Client A trying to close chat form home screen
Client A closed the chat from home screen and client B is prompted a dialog box informing that the chat room has been closed and asking whether to start a new search
Client B starts a new search