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
icon

Usage in Blueprints and C++


Asynchronous and synchronous method execution

Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.

  • Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes.

    1Channel->StartTypingAsync(OnStartTypingResponseDelegate);

    You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatOperationResponseNative).

  • Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly.

    1FPubnubChatOperationResult Result = Channel->StartTyping();
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

1Channel->StartTyping();

Output

TypeDescription
FPubnubChatOperationResult
Result of the operation. Check Error for failure.

Sample code

Reference code

This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.

Start a typing indicator on the incident-management channel.

Actor.h
1

Actor.cpp
1

Stop typing

StopTyping() deactivates the typing indicator on a channel.

Use this method to disable the typing indicator immediately (for example, when a user deletes a draft message) without waiting for the typingTimeout to end.

Method signature

1Channel->StopTyping();

Output

TypeDescription
FPubnubChatOperationResult
Result of the operation. Check Error for failure.

Sample code

Reference code

This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.

Stop a typing indicator on the incident-management channel.

Actor.h
1

Actor.cpp
1

Stream typing events

StreamTyping() 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. Users bind the OnTypingChanged multicast delegate before calling StreamTyping(). To stop receiving typing events, call StopStreamingTyping().

Method signature

1Channel->StreamTyping();

Bind the channel's OnTypingChanged delegate before calling StreamTyping() to receive typing events.

Output

TypeDescription
FPubnubChatOperationResult
Result of the operation. Check Error for failure.

Sample code

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

1

Other examples

Stop receiving typing signals on the support channel.

Actor.h
1

Actor.cpp
1

Last updated on