On this page

Typing indicator

Typing indicators show users when someone is composing a message. This feature:

  • Increases engagement - Users see activity in group chats
  • Sets expectations - Users know when to expect a response in 1:1 conversations
Not available for public chats

Typing indicator is disabled in public chats. If you try implementing this feature in a public channel type, you'll get the Typing indicators are not supported in Public chats error.

Start typing

StartTyping() activates the typing indicator on a channel.

The method uses a debounce mechanism: signals are sent at intervals rather than on every keystroke. The default timeout is 5000 ms (5 seconds), with a 1000 ms buffer to prevent rapid re-triggering.

Custom timeout

Set a custom timeout with the TypingTimeout parameter during initialization.

Method signature

This method has the following signature:

1channel.StartTyping()

Input

This method doesn't take any parameters.

Output

An awaitable Task<ChatOperationResult>.

Sample code

Start a typing indicator on the support channel.

1

Stop typing

StopTyping() deactivates a typing indicator on a given channel.

You can use this method in cases when you want to disable the typing indicator immediately.

Method signature

This method has the following signature:

1channel.StopTyping()

Input

This method doesn't take any parameters.

Output

An awaitable Task<ChatOperationResult>.

Sample code

Stop a typing indicator on the support channel.

1

Get typing events

Get up-to-date information about the real-time signals from typing users in the specified channel.

Use the StreamTyping() method to enable or disable typing event streaming on a channel, and the OnUsersTyping event to handle typing updates. These events let you constantly track who has started or stopped typing and visually represent that in your chat app through a typing indicator.

Method naming

Earlier versions used SetListeningForTyping() to enable streaming. This method has been superseded by StreamTyping(), though it remains available for backward compatibility.

Method signature

These methods take the following parameters:

  • StreamTyping()

    1channel.StreamTyping(bool stream)
  • OnUsersTyping - Event signature

    1// event on the Channel entity
    2public event Action<List<string>> OnUsersTyping;
    3// needs a corresponding event handler
    4void EventHandler(List<string> users)

Input

ParameterRequired in StreamTyping()Required in OnUsersTypingDescription
stream
Type: bool
Default:
n/a
Yes
n/a
Whether to start (true) or stop (false) listening to typing events on the channel.
users
Type: List<string>
Default:
n/a
No
Yes
List of typing user IDs.

Output

These methods don't return a value. Typing updates are delivered through the OnUsersTyping event handler.

Sample code

Get typing events on the support channel.

1

Last updated on