---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/typing-indicator
title: Typing indicator
updated_at: 2026-06-01T12:01:19.634Z
---

> 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

##### Under the hood

All typing indicator-related methods call PubNub Pub/Sub API and the JavaScript SDK [signal()](https://www.pubnub.com/docs/sdks/javascript/api-reference/publish-and-subscribe#subscribe) method. The `getTyping()` method also calls the [subscribe()](https://www.pubnub.com/docs/sdks/javascript/api-reference/publish-and-subscribe#subscribe) and [unsubscribe()](https://www.pubnub.com/docs/sdks/javascript/api-reference/publish-and-subscribe#unsubscribe) methods.

:::warning Not available for public chats
Typing indicator is disabled in [public chats](https://www.pubnub.com/docs/chat/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/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/chat-sdk/build/configuration#typing-indicator-timeout) during initialization.
:::

### Method signature

This method has the following signature:

```ts
channel.startTyping(): Promise<PublishResponse | undefined>
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `Promise<PublishResponse | undefined>` | Result of the published typing signal, or `undefined` if the signal was suppressed (e.g., debounced). |

### Sample code

Start a typing indicator on the `support` channel.

```ts
// reference the channel where you want to listen to typing signals
const channel = await chat.getChannel("support")
// invoke the "startTyping()" method
await channel.startTyping()
```

## 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/chat-sdk/build/features/channels/typing-indicator#start-typing) to end.

### Method signature

This method has the following signature:

```ts
channel.stopTyping(): Promise<PublishResponse | undefined>
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `Promise<PublishResponse | undefined>` | Result of the published typing signal, or `undefined` if the signal was suppressed. |

### Sample code

Stop a typing indicator on the `support` channel.

```ts
// reference the channel where you want to listen to typing signals
const channel = await chat.getChannel("support")
// invoke the "stopTyping()" method
await channel.stopTyping()
```

## Get typing events

`onTypingChanged()` adds a [signal events listener](https://www.pubnub.com/docs/sdks/javascript/api-reference/configuration#event-listeners) underneath to get all [events of type typing](https://www.pubnub.com/docs/chat/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 a function you can invoke to stop receiving `signal` events and unsubscribe from the channel.

### 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:

```ts
channel.onTypingChanged(
   callback: (typingUserIds: string[]) => void
): () => void
```

#### Input

| Parameter | Description |
| --- | --- |
| `callback` *Type: n/aDefault: n/a | Callback function passed as a parameter. It defines the custom behavior to be executed whenever someone starts/stops typing. |
| `> typingUserIds` *Type: `string[]`Default: n/a | Array with a list of all currently typing user IDs (`id`). |

#### Output

| Type | Description |
| --- | --- |
| `() => void` | Function you can call to disconnect (unsubscribe) from the channel and stop receiving `signal` events. |

### Sample code

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

```ts
// reference the channel where you want to listen to typing signals
const channel = await chat.getChannel("support")
// invoke the "onTypingChanged()" method
const stopListening = channel.onTypingChanged((typingUserIds) => {
   console.log("These channel members are currently typing: ", typingUserIds)
})

// after some time...
stopListening()
```

### Deprecated method

:::warning Deprecated
`getTyping()` is deprecated. Use [onTypingChanged()](#get-typing-events) instead.
:::

```ts
channel.getTyping(
   callback: (
      typingUserIds: string[]
   )  => unknown
): () => void
```