Typing indicators show when others are composing.
Sending typing events:
const sendTyping = throttle(() => {
ws.send(JSON.stringify({ type: 'TYPING', conversationId }));
}, 2000);
// In input onChange
if (text.length > 0) sendTyping();
Receiving typing events:
// Clear after timeout
useEffect(() => {
const timer = setTimeout(() => clearTyping(userId), 3000);
return () => clearTimeout(timer);
}, [lastTypingEvent]);
UX: Show "User is typing..." with animated dots. Clear after - seconds of inactivity.