---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/users/updates
title: Manage user updates
updated_at: 2026-06-19T11:35:29.629Z
---

> 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


# Manage user updates

Update user details and receive real-time update events.

##### Usage in Blueprints and C++

You can use PubNub's functionality via Blueprints or directly in C++ code.

* In Blueprints, you can access PubNub from any Widget or Actor. Start by [initializing chat](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/configuration#initialize-pubnub-chat) using `InitChat` on `UPubnubChatSubsystem`. Afterwards, you can use the returned `UPubnubChat` object reference to call all Chat SDK functions.

:::warning Blueprint functions
The Blueprints provided in the documentation show how you can structure your application and may contain utility methods and elements like buttons that are not part of the Unreal Chat SDK and are meant to serve as guidance.
:::

* In C++, you can use UPubnubChatSubsystem as any other Game Instance Subsystem. #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" #include "PubnubChatSubsystem.h" // ACTION REQUIRED: Replace ASample_ChatSubsystem with name of your Actor class void ASample_ChatSubsystem::InitChatSample() { // Get PubnubChatSubsystem from GameInstance UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this); UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>(); // Initialize Chat - InitChat may fail under some conditions so make sure to check the Result for errors before using the Chat FPubnubChatInitChatResult InitChatResult = PubnubChatSubsystem->InitChat(TEXT("demo"), TEXT("demo"), TEXT("Player_001")); UPubnubChat* PubnubChat = InitChatResult.Chat; } Chat now allows you to call all Chat SDK functions, for example, Chat->GetChannel("my_channel").

:::note 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. 1User->UpdateAsync(UpdateData, OnOperationResponseDelegate); 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 = User->Update(UpdateData);
:::

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data.
:::

## Update user details

Edit user metadata with `Update()` or `UpdateUser()`.

* `Update()` - call on a `User` object (no ID needed)
* `UpdateUser()` - call on a `Chat` object (requires user ID)

### Method signature

#### C++ / Input parameters

* User->Update() 1User->Update(FPubnubChatUpdateUserInputData UpdateUserData);
* Chat->UpdateUser() 1Chat->UpdateUser(2 FString UserID,3 FPubnubChatUpdateUserInputData UpdateUserData4);

| Parameter | Required in User->Update() | Required in Chat->UpdateUser() | Description |
| --- | --- | --- | --- |
| UserID | FString | Optional |  | No | Yes | [Unique user identifier](https://www.pubnub.com/docs/general/setup/users-and-devices#user-id-usage). |
| UpdateUserData | FPubnubChatUpdateUserInputData | Optional |  | Yes | Yes | User data fields to update and optional ForceSet flags. |

#### FPubnubChatUpdateUserInputData

| Parameter | Description |
| --- | --- |
| `UserName`Type: `FString`Default: `""` | Display name for the user (must not be empty or consist only of whitespace characters). |
| `ExternalID`Type: `FString`Default: `""` | User's identifier in an external system. You can use it to match `id` with a similar identifier from an external database. |
| `ProfileUrl`Type: `FString`Default: `""` | URL of the user's profile picture. |
| `Email`Type: `FString`Default: `""` | User's email address. |
| `Custom`Type: `FString`Default: `""` | JSON providing custom data about the user. Values must be scalar only; arrays or objects are not supported. [Filtering App Context data](https://www.pubnub.com/docs/general/metadata/filtering) through the `custom` property is not recommended in SDKs. |
| `Status`Type: `FString`Default: `""` | Tag that lets you categorize your app users by their current state. The tag choice is entirely up to you and depends on your use case. For example, you can use `status` to mark users in your chat app as `invited`, `active`, or `archived`. |
| `Type`Type: `FString`Default: `""` | Tag that lets you categorize your app users by their functional roles. The tag choice is entirely up to you and depends on your use case. For example, you can use `type` to group users by their roles in your app, such as `moderator`, `player`, or `support-agent`. |
| `ForceSetUserName`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging with the existing value. |
| `ForceSetExternalID`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |
| `ForceSetProfileUrl`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |
| `ForceSetEmail`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |
| `ForceSetCustom`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |
| `ForceSetStatus`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |
| `ForceSetType`Type: `bool`Default: `false` | When `true`, replaces the field value entirely instead of merging. |

#### Blueprint

:::tip API limits
To learn about the maximum length of parameters used to set user metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-user-metadata).
:::

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Returned object containing `Error` (bool) and `ErrorMessage` (FString). The same User object is updated in-place via the local cache. |

### Sample code

:::tip 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.
:::

Update user metadata asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint.btbt5i5w
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatUser")
void UpdateUserSample();
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::UpdateUserSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Fields to update (name, external ID, email, custom, status, type)
	FPubnubChatUpdateUserInputData UpdateData;
	UpdateData.UserName = TEXT("Jane Doe");
	UpdateData.ExternalID = TEXT("ext-001");
	UpdateData.Email = TEXT("jane.doe@example.com");

	// Update user metadata on the server (no result callback needed)
	User->UpdateAsync(UpdateData, nullptr);
}
```

###### Blueprint

* `UpdateUser()`

###### C++

```cpp
// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::UpdateUserSample()
{
	// snippet.hide
	UPubnubChat* Chat = nullptr;
	// snippet.show

	// Assumes Chat is a valid and initialized instance of UPubnubChat

	// Update a user's metadata asynchronously (e.g. player changed display name or status in settings)
	FPubnubChatUpdateUserInputData UpdateData;
	UpdateData.UserName = TEXT("NewDisplayName");
	UpdateData.Status = TEXT("InMatch");

	FOnPubnubChatUserResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
	Callback.BindUObject(this, &ASample_Chat::OnUpdateUserResponse);
	Chat->UpdateUserAsync(TEXT("Player_001"), UpdateData, Callback);
}

// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::OnUpdateUserResponse(const FPubnubChatUserResult& Result)
{
	if (Result.Result.Error) { return; }
	UPubnubChatUser* UpdatedUser = Result.User;
}
```

###### Blueprint

## Get user updates

Receive updates when [User objects](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/user) are edited or removed:

* `StreamUpdates()` - monitors a single user
* `StreamUpdatesOn()` - monitors multiple users (static method)
* `StopStreamingUpdates()` - stops monitoring

To receive updates, bind to the `OnUpdated` and `OnDeleted` multicast delegates on the `User` object before calling `StreamUpdates()`. Updates are delivered through the delegates rather than callback parameters.

:::note Delegate behavior
* `OnUpdated` - fires when user metadata changes (params: `FString UserID`, `FPubnubChatUserData UserData`)
* `OnDeleted` - fires when the user is deleted on the server (no params)
:::

### Method signature

#### C++ / Input parameters

* StreamUpdates() 1User->StreamUpdates();
* StreamUpdatesOn() (static) 1UPubnubChatUser::StreamUpdatesOn(2 const TArray<UPubnubChatUser*>& Users3);
* StopStreamingUpdates() 1User->StopStreamingUpdates();

| Parameter | Description |
| --- | --- |
| `Users`Type: `TArray<UPubnubChatUser*>`Default: n/a | Array of [User objects](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/user) for which you want to get updates. Each user must have its delegates bound before calling this method. |

#### Blueprint

##### Handle the response

Most methods in the Unreal Chat SDK return an `FPubnubChatOperationResult` (or a domain-specific result struct). Check the `Error` field to determine if the operation succeeded.

```cpp
FPubnubChatOperationResult Result = Channel->Connect();
if (Result.Error)
{
    UE_LOG(LogTemp, Error, TEXT("Operation failed: %s"), *Result.ErrorMessage);
}
```

For streaming operations (such as receiving messages, typing indicators, or channel updates), bind the channel's multicast delegate **before** calling the streaming method:

```cpp
Channel->OnMessageReceivedNative.AddUObject(this, &AMyActor::OnMessageReceived);
Channel->ConnectAsync(nullptr);
```

You can implement the callback function to handle the response as follows:

AMyActor.h

```cpp
void OnMessageReceived(UPubnubChatMessage* Message);
```

AMyActor.cpp

```cpp
void AMyActor::OnMessageReceived(UPubnubChatMessage* Message)
{
    UE_LOG(LogTemp, Log, TEXT("Received message: %s"), *Message->GetCurrentText());
}
```

#### Output

| Method | Return type | Description |
| --- | --- | --- |
| `StreamUpdates()` | `FPubnubChatOperationResult` | Operation result with `Error` (bool) and `ErrorMessage` (FString). No-op if already streaming. |
| `StreamUpdatesOn()` | `FPubnubChatOperationResult` | Combined operation result from calling `StreamUpdates()` on each user. |
| `StopStreamingUpdates()` | `FPubnubChatOperationResult` | Operation result. No-op if not streaming. |

### Sample code

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::StreamUpdatesSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Bind to receive user metadata updates and deletion events
	User->OnUpdatedNative.AddUObject(this, &ASample_ChatUser::OnUserUpdateReceived);
	User->OnDeletedNative.AddUObject(this, &ASample_ChatUser::OnUserDeleted);

	// Start streaming updates (no result callback needed)
	User->StreamUpdatesAsync(nullptr);

	// When updates are no longer needed, stop streaming
	User->StopStreamingUpdatesAsync(nullptr);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnUserUpdateReceived(FString UserID, const FPubnubChatUserData& UserData)
{
	/* e.g. refresh user UI with updated metadata */
}

void ASample_ChatUser::OnUserDeleted()
{
	/* e.g. remove user from list */
}
```

#### Blueprint