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() async throws -> Timetoken

Input

This method doesn't take any parameters.

Output

ParameterDescription
Timetoken
A Timetoken value indicating the action timestamp.

Sample code

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

Start a typing indicator on the support channel.

1

Stop typing

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

Use this method to disable the typing indicator immediately - for example, when a user deletes a previously drafted message - without waiting for the typingTimeout to end.

Method signature

This method has the following signature:

1channel.stopTyping() async throws -> Timetoken

Input

This method doesn't take any parameters.

Output

ParameterDescription
Timetoken
A Timetoken value indicating the action timestamp.

Sample code

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

Stop a typing indicator on the support channel.

1

Get typing events

getTyping() adds a signal events listener underneath to get all events of type Typing. Run it once on a given channel to start listening to typing signals and get a list of typing user IDs. This method also returns a function you can invoke to stop receiving signal events and unsubscribe from the channel.

Method signature

getTyping() returns an asynchronous stream that produces a new event whenever someone starts/stops typing.

This method has the following signature:

1channel.getTyping() -> AsyncStream<[String]>

Input

This method doesn't take any parameters.

Output

ParameterDescription
AsyncStream<[String]>
An asynchronous stream that emits an array of users currently typing.

Sample code

Sample code

The code samples in Swift Chat SDK focus on asynchronous code execution.

You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.

1

Last updated on