feat(chat-window): fix WS connection errors

This commit is contained in:
ItzCrazyKns 2024-07-14 12:37:36 +05:30
parent fac41d3812
commit e1732b9bf2
No known key found for this signature in database
GPG Key ID: 8162927C7CCE3065
1 changed files with 4 additions and 2 deletions

View File

@ -194,8 +194,10 @@ const useSocket = (
}
return () => {
ws?.close();
console.log('[DEBUG] closed');
if (ws?.readyState === 1) {
ws?.close();
console.log('[DEBUG] closed');
}
};
}, [ws, url, setIsWSReady, setError]);