feat(chat-window): display toast when retried

This commit is contained in:
ItzCrazyKns 2025-01-07 11:49:40 +05:30
parent b7f7d25f54
commit 99cae076a7

View file

@ -237,8 +237,11 @@ const useSocket = (
const interval = setInterval(() => { const interval = setInterval(() => {
if (ws.readyState === 1) { if (ws.readyState === 1) {
setIsWSReady(true); setIsWSReady(true);
retryCountRef.current = 0;
setError(false); setError(false);
if (retryCountRef.current > 0) {
toast.success('Connection restored.');
}
retryCountRef.current = 0;
clearInterval(interval); clearInterval(interval);
} }
}, 5); }, 5);