---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/typing-indicator
title: Typing indicator
updated_at: 2026-06-12T11:22:52.296Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# 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

:::warning Not available for public chats
Typing indicator is disabled in [public chats](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/create#create-public-channel). 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](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/configuration#input-parameters) is 5000 ms (5 seconds), with a 1000 ms buffer to prevent rapid re-triggering.

:::tip Custom timeout
Set a custom timeout with the [typingTimeout parameter](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/configuration#typing-indicator-timeout) during initialization.
:::

### Method signature

This method has the following signature:

```kotlin
channel.startTyping(): PNFuture<PNPublishResult?>
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<PNPublishResult?>` | Function that returns an instance of `PNFuture` that will be completed with a `PNPublishResult` when the `startTyping` operation is completed, or `null` if no signal was sent (e.g., the typing indicator was already active). |

### Sample code

Start a typing indicator on the `support` channel.

```kotlin
// assume `chat` is an instance of your chat service or client
// get the "support" channel asynchronously
chat.getChannel("support").async { result ->
    result.onSuccess { supportChannel ->
        // handle success
        // start the typing indicator on the "support" channel
        supportChannel.startTyping().async { typingResult ->
            typingResult.onSuccess {
                // typing indicator started successfully
                println("Typing indicator started on 'support' channel.")
            }.onFailure {
                // handle failure
            }
        }
    }.onFailure {
        // handle failure
    }
}
```

## 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 - for example, when a user deletes a previously drafted message - without waiting for the [typingTimeout](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/typing-indicator#start-typing) to end.

### Method signature

This method has the following signature:

```kotlin
channel.stopTyping(): PNFuture<PNPublishResult?>
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<PNPublishResult?>` | Function that returns an instance of `PNFuture` that will be completed with a `PNPublishResult` when the `stopTyping` operation is completed, or `null` if no signal was sent (e.g., the typing indicator was already inactive). |

### Sample code

Stop a typing indicator on the `support` channel.

```kotlin
// assume `chat` is an instance of your chat service or client
// get the "support" channel asynchronously
chat.getChannel("support").async { result ->
    result.onSuccess { supportChannel ->
        // handle success
        // stop the typing indicator on the "support" channel
        supportChannel.stopTyping().async { stopTypingResult ->
            stopTypingResult.onSuccess {
                // typing indicator stopped successfully
                println("Typing indicator stopped on 'support' channel.")
            }.onFailure {
                // handle failure
            }
        }
    }.onFailure {
        // handle failure
    }
}
```

## Get typing events

`onTypingChanged()` adds a [signal events listener](https://www.pubnub.com/docs/sdks/kotlin/api-reference/configuration#event-listeners) to get all [events of type typing](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/custom-events#events-for-typing-indicator). Run it once on a given channel to start listening to typing signals. You can also use it to get a list of typing user IDs. This method also returns an `AutoCloseable` you can invoke to stop receiving `signal` events and unsubscribe from the channel.

:::warning Deprecated method
`getTyping()` is deprecated. Use `onTypingChanged()` instead. Both methods have the same signature and behavior.
:::

### Method signature

`onTypingChanged()` accepts a callback function as an argument. The Chat SDK invokes this callback whenever someone starts/stops typing. This function takes a single argument of the list of currently typing user IDs.

This method takes the following parameters:

```kotlin
channel.onTypingChanged(callback: (typingUserIds: Collection<String>) -> Unit): AutoCloseable
```

#### Input

| Parameter | Description |
| --- | --- |
| `callback` *Type: `(typingUserIds: Collection<String>) -> Unit`Default: n/a | Callback function passed as a parameter. It defines the custom behavior to be executed whenever a collection of user IDs starts/stops typing. |

#### Output

| Type | Description |
| --- | --- |
| `AutoCloseable` | Interface you can call to disconnect (unsubscribe) from the channel and stop receiving `signal` events for someone typing by invoking the `close()` method. |

### Sample code

Get a list of user IDs currently typing on the `support` channel.

```kotlin
// assume `chat` is an instance of your chat service or client
// get the "support" channel asynchronously
chat.getChannel("support").async { result ->
    result.onSuccess { supportChannel ->
        // handle success
        // get the list of user IDs currently typing on the "support" channel
        val typingSubscription = supportChannel.onTypingChanged { typingUserIds ->
            if (typingUserIds.isNotEmpty()) {
                println("Users currently typing on 'support' channel: ${typingUserIds.joinToString(", ")}")
            } else {
                println("No users are typing on 'support' channel.")
            }
        }
    }.onFailure {
        // handle failure
    }
}
```

### Other examples

Stop receiving signals on the `support` channel.

```kotlin
// assume `chat` is an instance of your chat service or client
// get the "support" channel asynchronously
chat.getChannel("support").async { result ->
    result.onSuccess { supportChannel ->
        // handle success
        // get the list of user IDs currently typing on the "support" channel
        val typingSubscription = supportChannel.onTypingChanged { typingUserIds ->
            if (typingUserIds.isNotEmpty()) {
                println("Users currently typing on 'support' channel: ${typingUserIds.joinToString(", ")}")
            } else {
                println("No users are typing on 'support' channel.")
            }
        }

        // later, when you want to stop receiving typing signals:
        typingSubscription.close()
        println("Stopped receiving typing signals on 'support' channel.")

    }.onFailure {
        // handle failure
    }
}
```