Manage message updates

Requires Message Persistence

Edit messages and receive real-time update events.

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.

    1Message->EditTextAsync(NewText, OnEditTextResponseDelegate);

    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 = Message->EditText(NewText);

Edit messages​

EditText() replaces an existing message's content.

Method signature​

Output​

TypeDescription
FPubnubChatOperationResultResult of the operation. Check Error and ErrorMessage 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.

Edit message text asynchronously.

Actor.h​
1

Actor.cpp​
1

Get message updates​

Receive real-time updates when messages or reactions change:

  • StreamUpdates() - updates for a single Message object
  • StreamUpdatesOn() - updates for multiple Message objects

Bind the message's OnUpdated delegate (Blueprint) or OnUpdatedNative delegate (C++) before calling StreamUpdates(). Call StopStreamingUpdates() to stop receiving updates.

Stream update behavior
  • StreamUpdates() fires the message's OnUpdated delegate with (FString Timetoken, FPubnubChatMessageData MessageData) on each change.
  • StreamUpdatesOn() is a static method that calls StreamUpdates() on each message in the array. Each message fires its own OnUpdated delegate individually.

Method signature​

Output​

MethodReturn typeDescription
StreamUpdates()FPubnubChatOperationResultResult of the operation. Check Error for failure.
StreamUpdatesOn()FPubnubChatOperationResultResult of the operation. Check Error for failure.
StopStreamingUpdates()FPubnubChatOperationResultResult of the operation. Check Error for failure.

Sample code​

  • StreamUpdates()

    Get message and message reaction-related updates for a message published on the support channel.

1

Other examples​

Stop listening to updates for a message.

Actor.h​
1

Actor.cpp​
1

Was this page useful?

Last updated on