Typing indicator
Display a typing indicator when the other user is composing a message. This provides real-time feedback in direct channels.
Send typing status
Notify the other user that the current user is typing:
TypeScript
import { DirectChannel } from '@nexconn/chat';
const channel = new DirectChannel('<target-user-id>');
await channel.sendTypingStatus('RC:TxtMsg');
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
typingMessageType | string | Yes | The message type being composed (e.g., 'RC:TxtMsg' for text) |
Listen for typing status
Register a ChannelHandler to detect when the other user starts typing:
TypeScript
import { NCEngine, ChannelHandler } from '@nexconn/chat';
NCEngine.addChannelHandler('typing-handler', new ChannelHandler({
onTypingStatusChanged({ channelIdentifier, userTypingStatus }) {
console.log('User is typing in channel:', channelIdentifier, userTypingStatus);
},
}));
Remove the handler when it is no longer needed:
TypeScript
NCEngine.removeChannelHandler('typing-handler');
Typing status event data (ChannelUserTypingStatusInfo)
| Field | Type | Description |
|---|---|---|
userId | string | The ID of the user who is typing |
typingMessageType | string | The message type being composed |
sentTime | number | Timestamp (ms) when the typing status was sent |
tip
- The typing indicator is typically used in direct channels. It is not commonly used in group or community channels.
- The typing status is a transient signal — it does not persist. Your app should clear the typing indicator after a short timeout (e.g., 6 seconds) if no further typing status is received.