Skip to main content

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

ParameterTypeRequiredDescription
typingMessageTypestringYesThe 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)

FieldTypeDescription
userIdstringThe ID of the user who is typing
typingMessageTypestringThe message type being composed
sentTimenumberTimestamp (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.