App Context API for Unreal SDK

App Context provides easy-to-use, serverless storage for user and channel data you need to build innovative, reliable, scalable applications. Use App Context to easily store metadata about your application users and channels, and their membership associations, without the need to stand up your own databases.

PubNub also triggers events when object data is changed: set, updated, or removed from the database. At the same time, making a request to set the same data that already exist, doesn't trigger any event. Clients can receive these events in real time and update their front-end application accordingly.

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.

    1PubnubClient->GetAllUserMetadataAsync(OnGetAllUserMetadataResponse, Include, Limit, Filter, Sort, Page);

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

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

    1FPubnubGetAllUserMetadataResult Result = PubnubClient->GetAllUserMetadata(Include, Limit, Filter, Sort, Page);

User​

Get metadata for all users​

Retrieve user metadata in pages. The list includes the Custom object if requested.

Required keyset configuration
To get all channel and user metadata, you must uncheck the Disallow Get All Channel Metadata and Disallow Get All User Metadata checkboxes in the App Context section of your keyset configuration in the Admin Portal.

Method(s)​

Method variants

You can also call the GetAllUserMetadataRaw variant of this method which takes String values for Include and Sort instead of the FPubnubGetAllInclude and FPubnubGetAllSort structs.

1// Synchronous
2FPubnubGetAllUserMetadataResult Result = PubnubClient->GetAllUserMetadata(
3 FPubnubGetAllInclude Include = FPubnubGetAllInclude(),
4 int Limit = 100,
5 FString Filter = "",
6 FPubnubGetAllSort Sort = FPubnubGetAllSort(),
7 FPubnubPage Page = FPubnubPage()
8);
9
10// Asynchronous
11PubnubClient->GetAllUserMetadataAsync(
12 FOnPubnubGetAllUserMetadataResponse OnGetAllUserMetadataResponse,
13 FPubnubGetAllInclude Include = FPubnubGetAllInclude(),
14 int Limit = 100,
15 FString Filter = "",
show all 18 lines
* required
ParameterDescription
OnGetAllUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetAllUserMetadataResponseNative to handle the result using a lambda.
IncludeA list of property names to include in the response.
Limit
Type: int
Number of objects to return. Default/Max: 100.
Filter
Type: FString
Filter expression. Only matching objects are returned. See filtering.
SortSort by id, name, updated with asc/desc for sort direction (for example, {name: 'asc'}).
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.

FPubnubGetAllInclude​

FieldTypeDescription
IncludeCustomboolWhether to include the Custom object in the response.
IncludeStatusboolWhether to include the membership Status field.
IncludeTypeboolWhether to include the membership Type field.
IncludeTotalCountboolWhether to include the total count.

FPubnubGetAllSort​

FieldTypeDescription
GetAllSortTArray<FPubnubGetAllSingleSort>Array of sorts for Membership related function. The order matters, sorts will be applied from the first index to the last.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Other examples​
Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get metadata for all users with additional settings​
Actor.h​
1

Actor.cpp​
1

Get metadata for all users with all includes​
Actor.h​
1

Actor.cpp​
1

Get metadata for all users with lambda​
Actor.h​
1

Actor.cpp​
1

Get metadata for all users raw​
Actor.h​
1

Actor.cpp​
1

Returns​

FPubnubGetAllUserMetadataResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
UsersDataTArray<FPubnubUserData>Array of FPubnubUserData structs which are the users with their associated User metadata.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of users matching the request (when requested).
FOnPubnubGetAllUserMetadataResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
UsersDataconst TArray<FPubnubUserData>&Array of FPubnubUserData structs which are the users with their associated User metadata.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of users matching the request (when requested).
FPubnubPage​

FieldTypeDescription
NextFStringCursor for forward pagination. Use in the next request to fetch the following page.
PrevFStringCursor for backward pagination. Use in the next request to fetch the previous page. Ignored if Next is supplied.
FPubnubUserData​

FieldTypeDescription
UserIDFStringUUID. If not supplied, the current user's UUID is used.
UserNameFStringDisplay name for the user.
ExternalIDFStringUser's identifier in an external system.
ProfileUrlFStringThe URL of the user's profile picture.
EmailFStringThe user's email address.
CustomFStringCustom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
StatusFStringUser status. Max. 50 characters.
TypeFStringUser type. Max. 50 characters.
UpdatedFStringThe date when the user's metadata was last updated.
ETagFStringInformation on the object's content fingerprint.
FOnPubnubGetAllUserMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
UsersDataconst TArray<FPubnubUserData>&Array of FPubnubUserData structs which are the users with their associated User metadata.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of users matching the request (when requested).

Get user metadata - UserMetadata entity​

icon

Available in entities

UserMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Retrieve metadata for a user. You can include the Custom object.

Method(s)​

1UPubnubUserMetadataEntity* UserMetadataEntity = PubnubSubsystem->CreateUserMetadataEntity("user-id");
2
3UserMetadataEntity->GetUserMetadata(
4 FOnGetUserMetadataResponse OnGetUserMetadataResponse,
5 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
6);
* required
ParameterDescription
OnGetUserMetadataResponse *The delegate for the operation's result.

You can also use a native callback of the type FOnGetUserMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

This function is void, but the delegate returns the FOnGetUserMetadataResponse struct.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get user metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Get user metadata - PubNub client​

Retrieve metadata for a user. You can include the Custom object.

Method(s)​

1// Synchronous
2FPubnubUserMetadataResult Result = PubnubClient->GetUserMetadata(
3 FString User,
4 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
5);
6
7// Asynchronous
8PubnubClient->GetUserMetadataAsync(
9 FString User,
10 FOnPubnubGetUserMetadataResponse OnGetUserMetadataResponse,
11 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
12);
* required
ParameterDescription
User *
Type: FString
The metadata ID for which to retrieve the user object. Can't be empty.
OnGetUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetUserMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FPubnubUserMetadataResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
UserDataFPubnubUserDataThe user with their associated User metadata.
FOnPubnubGetUserMetadataResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
UserDataFPubnubUserDataThe user with their associated User metadata.
FOnPubnubGetUserMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
UserDataconst FPubnubUserData&The user with their associated User metadata.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get metadata for a user with all includes​
Actor.h​
1

Actor.cpp​
1

Get metadata for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Get metadata for a user raw​
Actor.h​
1

Actor.cpp​
1

Set user metadata with additional settings​
Actor.h​
1

Actor.cpp​
1

Set user metadata with result struct​
Actor.h​
1

Actor.cpp​
1

Remove user metadata with result struct​
Actor.h​
1

Actor.cpp​
1

Set user metadata - UserMetadata entity​

icon

Available in entities

UserMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Unsupported partial updates of custom metadata

The value of the custom metadata parameter sent in this method always overwrites the value stored on PubNub servers. If you want to add new custom data to an existing one, you must:

  1. Get the existing metadata and store it locally.
  2. Append the new custom metadata to the existing one.
  3. Set the entire updated custom object.

Set metadata for a User in the database, optionally including the custom data object for each.

Method(s)​

1UPubnubUserMetadataEntity* UserMetadataEntity = PubnubSubsystem->CreateUserMetadataEntity("user-id");
2
3UserMetadataEntity->SetUserMetadata(
4 FPubnubUserData UserMetadata,
5 FOnSetUserMetadataResponse OnSetUserMetadataResponse,
6 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
7);
* required
ParameterDescription
UserMetadataThe user metadata object to create.
FOnSetUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnSetUserMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

1{
2 "Uuid": "uuid-1",
3 "Name": "John Doe",
4 "Email": "john.doe@pubnub.com",
5 "ExternalId": "",
6 "ProfileUrl": "",
7 "Custom": "",
8 "Updated": "2020-06-17T16:28:14.060718Z"
9}

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set user metadata with result​
Actor.h​
1

Actor.cpp​
1

Set user metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Set user metadata - PubNub client​

Unsupported partial updates of custom metadata

The value of the custom metadata parameter sent in this method always overwrites the value stored on PubNub servers. If you want to add new custom data to an existing one, you must:

  1. Get the existing metadata and store it locally.
  2. Append the new custom metadata to the existing one.
  3. Set the entire updated custom object.

Set metadata for a User in the database, optionally including the custom data object for each. Use FPubnubUserInputData for the metadata payload (supports ForceSet fields for partial updates).

Method(s)​

1// Synchronous
2FPubnubUserMetadataResult Result = PubnubClient->SetUserMetadata(
3 FString User,
4 FPubnubUserInputData UserMetadata,
5 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
6);
7
8// Asynchronous
9PubnubClient->SetUserMetadataAsync(
10 FString User,
11 FPubnubUserInputData UserMetadata,
12 FOnPubnubSetUserMetadataResponse OnSetUserMetadataResponse,
13 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
14);
* required
ParameterDescription
User *
Type: FString
The metadata ID for which to set the user object. Can't be empty.
UserMetadata *The user metadata to set (input struct; supports ForceSet for partial updates).
OnSetUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubSetUserMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

FPubnubUserInputData​

Used for set operations. Contains the same fields as FPubnubUserData (e.g. UserName, Email, Custom, etc.). When present, ForceSet-style fields control which properties are updated (partial updates).

FPubnubGetMetadataInclude​

FieldTypeDescription
IncludeCustomboolWhether to include the object's Custom field.
IncludeStatusboolWhether to include the object's Status field.
IncludeTypeboolWhether to include the object's Type field.

Returns​

FOnPubnubSetUserMetadataResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
UserDataFPubnubUserDataThe user metadata object that was set.

FOnPubnubSetUserMetadataResponseNative​

FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
UserDataconst FPubnubUserData&The user metadata object that was set.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set metadata for a user with result​
Actor.h​
1

Actor.cpp​
1

Set metadata for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Set metadata for a user raw​
Actor.h​
1

Actor.cpp​
1

Iteratively update existing metadata​
Actor.h​
1

Actor.cpp​
1

Remove user metadata - UserMetadata entity​

icon

Available in entities

UserMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Removes the metadata from a specified user UUID.

Method(s)​

1UPubnubUserMetadataEntity* UserMetadataEntity = PubnubSubsystem->CreateUserMetadataEntity("user-id");
2
3UserMetadataEntity->RemoveUserMetadata(
4 FOnRemoveUserMetadataResponse OnRemoveUserMetadataResponse
5);
* required
ParameterDescription
OnRemoveUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnRemoveUserMetadataResponseNative to handle the result using a lambda.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

This function is void, but the delegate returns the FOnRemoveUserMetadataResponse struct.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove user metadata with result​
Actor.h​
1

Actor.cpp​
1

Remove user metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Remove user metadata - PubNub client​

Removes the metadata from a specified user UUID.

Method(s)​

1// Synchronous
2FPubnubOperationResult Result = PubnubClient->RemoveUserMetadata(FString User);
3
4// Asynchronous
5PubnubClient->RemoveUserMetadataAsync(FString User, FOnPubnubRemoveUserMetadataResponse OnRemoveUserMetadataResponse);
* required
ParameterDescription
User *
Type: FString
The metadata ID to delete from the user object. Can't be empty.
OnRemoveUserMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubRemoveUserMetadataResponseNative to handle the result using a lambda.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FOnPubnubRemoveUserMetadataResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
FOnPubnubRemoveUserMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove metadata for a user with result​
Actor.h​
1

Actor.cpp​
1

Remove metadata for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Channel​

Get metadata for all channels​

Retrieve channel metadata in pages. The list includes the Custom object if requested.

Method(s)​

Method variants

You can also call the GetAllChannelMetadataRaw variant of this method which takes String values for Include and Sort instead of the FPubnubGetAllInclude and FPubnubGetAllSort structs.

1// Synchronous
2FPubnubGetAllChannelMetadataResult Result = PubnubClient->GetAllChannelMetadata(
3 FPubnubGetAllInclude Include = FPubnubGetAllInclude(),
4 int Limit = 100,
5 FString Filter = "",
6 FPubnubGetAllSort Sort = FPubnubGetAllSort(),
7 FPubnubPage Page = FPubnubPage()
8);
9
10// Asynchronous
11PubnubClient->GetAllChannelMetadataAsync(
12 FOnPubnubGetAllChannelMetadataResponse OnGetAllChannelMetadataResponse,
13 FPubnubGetAllInclude Include = FPubnubGetAllInclude(),
14 int Limit = 100,
15 FString Filter = "",
show all 18 lines
* required
ParameterDescription
OnGetAllChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetAllChannelMetadataResponseNative to handle the result using a lambda.
IncludeA list of property names to include in the response.
Limit
Type: int
Number of objects to return. Default/Max: 100.
Filter
Type: FString
Filter expression. Only matching objects are returned. See filtering.
SortSort by id, name, updated with asc/desc for sort direction (for example, {name: 'asc'}).
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FPubnubGetAllChannelMetadataResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
ChannelsDataTArray<FPubnubChannelData>Array of FPubnubChannelData structs which are the channels with their associated metadata.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of channels matching the request (when requested).
FOnPubnubGetAllChannelMetadataResponse​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
ChannelsDataconst TArray<FPubnubChannelData>&Array of FPubnubChannelData structs which are the channels with their associated metadata.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of channels matching the request (when requested).
FPubnubChannelData​
FieldTypeDescription
ChannelIDFStringID of the channel.
ChannelNameFStringName of the channel.
DescriptionFStringAdditional description of the channel.
CustomFStringCustom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
StatusFStringChannel status. Max 50 characters.
TypeFStringChannel type. Max 50 characters.
UpdatedFStringThe date when the channel's metadata was last updated.
ETagFStringVersion identifier of the user's metadata.
FOnPubnubGetAllChannelMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
ChannelsDataconst TArray<FPubnubChannelData>&Array of FPubnubChannelData structs which are the channels with their associated metadata.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of channels matching the request (when requested).

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get metadata for all channels with settings​
Actor.h​
1

Actor.cpp​
1

Get metadata for all channels with all includes​
Actor.h​
1

Actor.cpp​
1

Get metadata for all channels with lambda​
Actor.h​
1

Actor.cpp​
1

Get metadata for all channels raw​
Actor.h​
1

Actor.cpp​
1

Get channel metadata - ChannelMetadata entity​

icon

Available in entities

ChannelMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Retrieve metadata for a channel. You can include the Custom object.

Method(s)​

1UPubnubChannelMetadataEntity* ChannelMetadataEntity = PubnubSubsystem->CreateChannelMetadataEntity("channel-id");
2
3ChannelMetadataEntity->GetChannelMetadata(
4 FOnGetChannelMetadataResponse OnGetChannelMetadataResponse,
5 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
6);
* required
ParameterDescription
OnGetChannelMetadataResponse *The delegate for the operation's result.

You can also use a native callback of the type FOnGetChannelMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

This function is void, but the delegate returns the FOnGetChannelMetadataResponse struct.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get channel metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Get channel metadata - PubNub client​

Retrieve metadata for a channel. You can include the Custom object.

Method(s)​

1// Synchronous
2FPubnubChannelMetadataResult Result = PubnubClient->GetChannelMetadata(
3 FString Channel,
4 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
5);
6
7// Asynchronous
8PubnubClient->GetChannelMetadataAsync(
9 FString Channel,
10 FOnPubnubGetChannelMetadataResponse OnGetChannelMetadataResponse,
11 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
12);
* required
ParameterDescription
Channel *
Type: FString
The channel ID for which to retrieve the channel object. Can't be empty.
OnGetChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetChannelMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FPubnubChannelMetadataResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
ChannelDataFPubnubChannelDataThe channel with its associated metadata.
FOnPubnubGetChannelMetadataResponse​
FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
ChannelDataFPubnubChannelDataThe channel with its associated metadata.
FOnPubnubGetChannelMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
ChannelDataconst FPubnubChannelData&The channel with its associated metadata.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get metadata for a channel with all includes​
Actor.h​
1

Actor.cpp​
1

Get metadata for a channel with lambda​
Actor.h​
1

Actor.cpp​
1

Get metadata for a channel raw​
Actor.h​
1

Actor.cpp​
1

Set channel metadata with additional settings​
Actor.h​
1

Actor.cpp​
1

Set channel metadata with result struct​
Actor.h​
1

Actor.cpp​
1

Remove channel metadata with result struct​
Actor.h​
1

Actor.cpp​
1

Set channel metadata - ChannelMetadata entity​

icon

Available in entities

ChannelMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Unsupported partial updates of custom metadata

The value of the custom metadata parameter sent in this method always overwrites the value stored on PubNub servers. If you want to add new custom data to an existing one, you must:

  1. Get the existing metadata and store it locally.
  2. Append the new custom metadata to the existing one.
  3. Set the entire updated custom object.

Set metadata for a channel in the database, optionally including the custom data object for each.

Method(s)​

1UPubnubChannelMetadataEntity* ChannelMetadataEntity = PubnubSubsystem->CreateChannelMetadataEntity("channel-id");
2
3ChannelMetadataEntity->SetChannelMetadata(
4 FPubnubChannelData ChannelMetadata,
5 FOnSetChannelMetadataResponse OnSetChannelMetadataResponse,
6 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
7);
* required
ParameterDescription
ChannelMetadataThe channel metadata object to create.
FOnSetChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnSetChannelMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
API limits

To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

1{
2 "Channel": "my-channel",
3 "Name": "PubNub channel",
4 "Description": "The channel for announcements",
5 "Updated": "2020-06-17T16:52:19.562469Z"
6}

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set channel metadata with result​
Actor.h​
1

Actor.cpp​
1

Set channel metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Set channel metadata - PubNub client​

Unsupported partial updates of custom metadata

The value of the custom metadata parameter sent in this method always overwrites the value stored on PubNub servers. If you want to add new custom data to an existing one, you must:

  1. Get the existing metadata and store it locally.
  2. Append the new custom metadata to the existing one.
  3. Set the entire updated custom object.

Set metadata for a channel in the database, optionally including the custom data object for each. Use FPubnubChannelInputData for the metadata payload (supports ForceSet fields for partial updates).

Method(s)​

1// Synchronous
2FPubnubChannelMetadataResult Result = PubnubClient->SetChannelMetadata(
3 FString Channel,
4 FPubnubChannelInputData ChannelMetadata,
5 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
6);
7
8// Asynchronous
9PubnubClient->SetChannelMetadataAsync(
10 FString Channel,
11 FPubnubChannelInputData ChannelMetadata,
12 FOnPubnubSetChannelMetadataResponse OnSetChannelMetadataResponse,
13 FPubnubGetMetadataInclude Include = FPubnubGetMetadataInclude()
14);
* required
ParameterDescription
Channel *
Type: FString
The metadata ID for which to set the channel object. Can't be empty.
ChannelMetadata *The channel metadata to set (input struct; supports ForceSet for partial updates).
OnSetChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubSetChannelMetadataResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
API limits

To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.

FPubnubChannelInputData​

Used for set operations. Contains the same fields as FPubnubChannelData (e.g. ChannelName, Description, Custom, etc.). When present, ForceSet-style fields control which properties are updated (partial updates).

Returns​

FOnPubnubSetChannelMetadataResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
ChannelDataFPubnubChannelDataThe channel metadata object that was set.

FOnPubnubSetChannelMetadataResponseNative​

FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
ChannelDataconst FPubnubChannelData&The channel metadata object that was set.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set metadata for a channel with result​
Actor.h​
1

Actor.cpp​
1

Set metadata for a channel with lambda​
Actor.h​
1

Actor.cpp​
1

Set metadata for a channel raw​
Actor.h​
1

Actor.cpp​
1

Iteratively update existing metadata​
Actor.h​
1

Actor.cpp​
1

Remove channel metadata - ChannelMetadata entity​

icon

Available in entities

ChannelMetadata

Requires App Context add-on

This method requires the App Context add-on enabled for your key in the Admin Portal.

Removes the metadata from a specified channel.

Method(s)​

1UPubnubChannelMetadataEntity* ChannelMetadataEntity = PubnubSubsystem->CreateChannelMetadataEntity("channel-id");
2
3ChannelMetadataEntity->RemoveChannelMetadata(
4 FOnRemoveChannelMetadataResponse OnRemoveChannelMetadataResponse
5);
* required
ParameterDescription
OnRemoveChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnRemoveChannelMetadataResponseNative to handle the result using a lambda.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

This function is void, but the delegate returns the FOnRemoveChannelMetadataResponse struct.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove channel metadata with result​
Actor.h​
1

Actor.cpp​
1

Remove channel metadata with lambda​
Actor.h​
1

Actor.cpp​
1

Remove channel metadata - PubNub client​

Removes the metadata from a specified channel.

Method(s)​

1// Synchronous
2FPubnubOperationResult Result = PubnubClient->RemoveChannelMetadata(FString Channel);
3
4// Asynchronous
5PubnubClient->RemoveChannelMetadataAsync(FString Channel, FOnPubnubRemoveChannelMetadataResponse OnRemoveChannelMetadataResponse);
* required
ParameterDescription
Channel *
Type: FString
The metadata ID to delete from the channel object. Can't be empty.
OnRemoveChannelMetadataResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubRemoveChannelMetadataResponseNative to handle the result using a lambda.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FOnPubnubRemoveChannelMetadataResponse​
FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
FOnPubnubRemoveChannelMetadataResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove metadata for a channel with result​
Actor.h​
1

Actor.cpp​
1

Remove metadata for a channel with lambda​
Actor.h​
1

Actor.cpp​
1

Channel memberships​

Get channel memberships​

The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

Method(s)​

Method variants

You can also call the GetMembershipsRaw variant of this method which takes String values for Include and Sort instead of the FPubnubMembershipInclude and FPubnubMembershipSort structs.

1// Synchronous
2FPubnubMembershipsResult Result = PubnubClient->GetMemberships(
3 FString User,
4 FPubnubMembershipInclude Include = FPubnubMembershipInclude(),
5 int Limit = 100,
6 FString Filter = "",
7 FPubnubMembershipSort Sort = FPubnubMembershipSort(),
8 FPubnubPage Page = FPubnubPage()
9);
10
11// Asynchronous
12PubnubClient->GetMembershipsAsync(
13 FString User,
14 FOnPubnubGetMembershipsResponse OnGetMembershipsResponse,
15 FPubnubMembershipInclude Include = FPubnubMembershipInclude(),
show all 20 lines
* required
ParameterDescription
User *
Type: FString
The user UUID for whom to retrieve memberships.
OnGetMembershipsResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetMembershipsResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
Number of objects to return. Default/Max: 100.
Filter
Type: FString
Filter expression. Only matching objects are returned. See filtering.
SortKey-value pair of a property to sort by, and a sort direction.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.

FPubnubMembershipInclude​

Field NameTypeDefault ValueDescription
IncludeCustomboolfalseWhether to include the membership's Custom field.
IncludeStatusboolfalseWhether to include the membership's Status field.
IncludeTypeboolfalseWhether to include the membership's Type field.
IncludeChannelboolfalseWhether to include the membership's Channel data field (in form of FPubnubChannelData).
IncludeChannelCustomboolfalseWhether to include the membership's Channel Custom field.
IncludeChannelStatusboolfalseWhether to include the membership's Channel Status field
IncludeChannelTypeboolfalseWhether to include the membership's Channel Type field
IncludeTotalCountboolfalseWhether to include the total count of memberships

FPubnubMembershipSort​

Field NameTypeDescription
MembershipSortTArray<FPubnubMembershipSingleSort>Array of sort criteria used in Membership-related functions. Order matters (applied in sequence).

FPubnubMembershipSingleSort​

Field NameTypeDefaultDescription
SortTypeEPubnubMembershipSortTypeEPubnubMembershipSortType::PMST_ChannelIDField to sort by in the Membership context
SortOrderboolfalseAscending when false, descending when true

EPubnubMembershipSortType​

Enum ValueDisplay NameDescription
PMST_ChannelIDChannelIDSort by Channel ID
PMST_ChannelNameChannelNameSort by Channel Name
PMST_ChannelUpdatedChannelUpdatedSort by last update to the Channel
PMST_ChannelStatusChannelStatusSort by Channel Status
PMST_ChannelTypeChannelTypeSort by Channel Type
PMST_UpdatedUpdatedSort by Membership update timestamp
PMST_StatusStatusSort by Membership status
PMST_TypeTypeSort by Membership type

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FPubnubMembershipsResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembershipsDataTArray<FPubnubMembershipData>Array of FPubnubMembershipData structs which are the memberships.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).
FOnPubnubGetMembershipsResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).
FPubnubMembershipData​

FieldTypeDescription
ChannelFPubnubChannelDataContains channel metadata, including unique channel identifier and other relevant information.
CustomFStringCustom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
StatusFStringStatus of the membership. Max 50 characters.
TypeFStringType of the membership. Max 50 characters.
UpdatedFStringThe date when the channel's membership was last updated.
ETagFStringVersion identifier of the membership metadata.
FOnPubnubGetMembershipsResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get memberships for a user with settings​
Actor.h​
1

Actor.cpp​
1

Get memberships for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Get memberships for a user with raw​
Actor.h​
1

Actor.cpp​
1

Set channel memberships​

Set channel memberships for a User.

Method(s)​

1// Synchronous
2FPubnubMembershipsResult Result = PubnubClient->SetMemberships(
3 FString User,
4 TArray<FPubnubMembershipInputData> Channels,
5 FPubnubMembershipInclude Include = FPubnubMembershipInclude(),
6 int Limit = 100,
7 FString Filter = "",
8 FPubnubMembershipSort Sort = FPubnubMembershipSort(),
9 FPubnubPage Page = FPubnubPage()
10);
11
12// Asynchronous
13PubnubClient->SetMembershipsAsync(
14 FString User,
15 TArray<FPubnubMembershipInputData> Channels,
show all 22 lines
* required
ParameterDescription
User *
Type: FString
The user UUID to add/update the memberships. Can't be empty.
Channels *The array of channel memberships to add/update. Can't be empty.
OnSetMembershipsResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubSetMembershipsResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
The maximum number of memberships to return.
Filter
Type: FString
The filter to apply to the memberships.
SortThe sort order to apply to the memberships.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

FPubnubMembershipInputData​

FieldTypeDescription
ChannelFStringThe channel ID to add/update the membership. Can't be empty.
CustomFStringThe custom data to add/update the membership.
StatusFStringThe status of the membership.
TypeFStringThe type of the membership.

Returns​

FOnPubnubSetMembershipsResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).

FOnPubnubSetMembershipsResponseNative​

FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

API limits

To learn about the maximum length of parameters used to set channel membership metadata, refer to REST API docs.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set memberships for a user with result​
Actor.h​
1

Actor.cpp​
1

Set memberships for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Set memberships for a user with raw​
Actor.h​
1

Actor.cpp​
1

Remove Channel Memberships​

Remove channel memberships for a user.

Method(s)​

1// Synchronous
2FPubnubMembershipsResult Result = PubnubClient->RemoveMemberships(
3 FString User,
4 TArray<FString> Channels,
5 FPubnubMembershipInclude Include = FPubnubMembershipInclude(),
6 int Limit = 100,
7 FString Filter = "",
8 FPubnubMembershipSort Sort = FPubnubMembershipSort(),
9 FPubnubPage Page = FPubnubPage()
10);
11
12// Asynchronous
13PubnubClient->RemoveMembershipsAsync(
14 FString User,
15 TArray<FString> Channels,
show all 22 lines
* required
ParameterDescription
User *
Type: FString
The user UUID to remove the memberships. Can't be empty.
Channels *
Type: TArray<FString>
The array of channel IDs to remove the memberships. Can't be empty.
OnRemoveMembershipsResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubRemoveMembershipsResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
The maximum number of memberships to return.
Filter
Type: FString
The filter to apply to the memberships.
SortThe sort order to apply to the memberships.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FOnPubnubRemoveMembershipsResponse​
FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).
FOnPubnubRemoveMembershipsResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembershipsDataconst TArray<FPubnubMembershipData>&Array of FPubnubMembershipData structs which are the memberships.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of memberships matching the request (when requested).

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove memberships for a user with result​
Actor.h​
1

Actor.cpp​
1

Remove memberships for a user with lambda​
Actor.h​
1

Actor.cpp​
1

Remove memberships for a user with raw​
Actor.h​
1

Actor.cpp​
1

Channel members​

Get channel members​

The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

Method(s)​

Method variants

You can also call the GetChannelMembersRaw variant of this method which takes String values for Include, and Sort instead of the FPubnubMemberInclude and FPubnubMemberSort structs.

1// Synchronous
2FPubnubChannelMembersResult Result = PubnubClient->GetChannelMembers(
3 FString Channel,
4 FPubnubMemberInclude Include = FPubnubMemberInclude(),
5 int Limit = 100,
6 FString Filter = "",
7 FPubnubMemberSort Sort = FPubnubMemberSort(),
8 FPubnubPage Page = FPubnubPage()
9);
10
11// Asynchronous
12PubnubClient->GetChannelMembersAsync(
13 FString Channel,
14 FOnPubnubGetChannelMembersResponse OnGetChannelMembersResponse,
15 FPubnubMemberInclude Include = FPubnubMemberInclude(),
show all 20 lines
* required
ParameterDescription
Channel *
Type: FString
The Channel ID for which to retrieve members.
OnGetChannelMembersResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubGetChannelMembersResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
Number of objects to return. Default/Max: 100.
Filter
Type: FString
Expression used to filter the results. Check online documentation to see exact filter formulas.
SortKey-value pair of a property to sort by, and a sort direction.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.

FPubnubMemberInclude​

Field NameTypeDefaultDescription
IncludeCustomboolfalseWhether to include the member's Custom field
IncludeStatusboolfalseWhether to include the member's Status field
IncludeTypeboolfalseWhether to include the member's Type field
IncludeUUIDboolfalseWhether to include the member's User data (FPubnubUUIDMetadata)
IncludeUUIDCustomboolfalseWhether to include the member's User Custom field
IncludeUUIDStatusboolfalseWhether to include the member's User Status field
IncludeUUIDTypeboolfalseWhether to include the member's User Type field
IncludeTotalCountboolfalseWhether to include the total count of paginated records

FPubnubMemberSort​

Field NameTypeDescription
MemberSortTArray<FPubnubMemberSingleSort>Array of sort criteria used in Member-related functions. Order matters (applied in sequence).

FPubnubMemberSingleSort​

Field NameTypeDefaultDescription
SortTypeEPubnubMemberSortTypeEPubnubMemberSortType::PMeST_UserIDField to sort by in the Member context
SortOrderboolfalseAscending when false, descending when true

EPubnubMemberSortType​

Enum ValueDisplay NameDescription
PMeST_UserIDUserIDSort by Member's User ID
PMeST_UserNameUserNameSort by Member's User Name
PMeST_UserUpdatedUserUpdatedSort by when the User was updated
PMeST_UserStatusUserStatusSort by User Status
PMeST_UserTypeUserTypeSort by User Type
PMeST_UpdatedUpdatedSort by Member record update timestamp
PMeST_StatusStatusSort by Member Status
PMeST_TypeTypeSort by Member Type

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FPubnubChannelMembersResult​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembersDataTArray<FPubnubChannelMemberData>Array of FPubnubChannelMemberData structs which are the members of the channel.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).
FOnPubnubGetChannelMembersResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).
FPubnubChannelMemberData​

FieldTypeDescription
UserFPubnubUserDataContains user metadata, including unique user identifier and other relevant information.
CustomFStringCustom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn't supported.
StatusFStringStatus of the member. Max 50 characters.
TypeFStringType of the member. Max 50 characters.
UpdatedFStringThe date when the channel's member was last updated.
ETagFStringVersion identifier of the member metadata.
FOnPubnubGetChannelMembersResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Get channel members with settings​
Actor.h​
1

Actor.cpp​
1

Get channel members with lambda​
Actor.h​
1

Actor.cpp​
1

Get channel members raw​
Actor.h​
1

Actor.cpp​
1

Set channel members​

This method sets members in a channel.

Method(s)​

1// Synchronous
2FPubnubChannelMembersResult Result = PubnubClient->SetChannelMembers(
3 FString Channel,
4 TArray<FPubnubChannelMemberInputData> Users,
5 FPubnubMemberInclude Include = FPubnubMemberInclude(),
6 int Limit = 100,
7 FString Filter = "",
8 FPubnubMemberSort Sort = FPubnubMemberSort(),
9 FPubnubPage Page = FPubnubPage()
10);
11
12// Asynchronous
13PubnubClient->SetChannelMembersAsync(
14 FString Channel,
15 TArray<FPubnubChannelMemberInputData> Users,
show all 22 lines
* required
ParameterDescription
Channel *
Type: FString
The channel ID to add/update the members. Can't be empty.
Users *The array of channel members to add/update. Can't be empty.
OnSetChannelMembersResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubSetChannelMembersResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
The maximum number of members to return.
Filter
Type: FString
The filter to apply to the members.
SortThe sort order to apply to the members.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.
API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

FPubnubChannelMemberInputData​

FieldTypeDescription
UserFStringThe user UUID to add/update the membership. Can't be empty.
CustomFStringThe custom data to add/update the membership.
StatusFStringThe status of the membership.
TypeFStringThe type of the membership.

Returns​

FOnPubnubSetChannelMembersResponse​

FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).

FOnPubnubSetChannelMembersResponseNative​

FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

API limits

To learn about the maximum length of parameters used to set channel members metadata, refer to REST API docs.

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Set channel members with result​
Actor.h​
1

Actor.cpp​
1

Set channel members with lambda​
Actor.h​
1

Actor.cpp​
1

Set channel members raw​
Actor.h​
1

Actor.cpp​
1

Remove Channel Members​

Remove members from a channel.

Method(s)​

1// Synchronous
2FPubnubChannelMembersResult Result = PubnubClient->RemoveChannelMembers(
3 FString Channel,
4 TArray<FString> Users,
5 FPubnubMemberInclude Include = FPubnubMemberInclude(),
6 int Limit = 100,
7 FString Filter = "",
8 FPubnubMemberSort Sort = FPubnubMemberSort(),
9 FPubnubPage Page = FPubnubPage()
10);
11
12// Asynchronous
13PubnubClient->RemoveChannelMembersAsync(
14 FString Channel,
15 TArray<FString> Users,
show all 22 lines
* required
ParameterDescription
Channel *
Type: FString
The channel ID to remove the members. Can't be empty.
Users *
Type: TArray<FString>
The array of user UUIDs to remove from the channel. Can't be empty.
OnRemoveChannelMembersResponseThe delegate for the operation's result.

You can also use a native callback of the type FOnPubnubRemoveChannelMembersResponseNative to handle the result using a lambda.
IncludeList of property names to include in the response.
Limit
Type: int
The maximum number of members to return.
Filter
Type: FString
The filter to apply to the members.
SortThe sort order to apply to the members.
PageCursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page.

Sample code​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

Actor.h​


1

Actor.cpp​


1

Returns​

FOnPubnubRemoveChannelMembersResponse​
FieldTypeDescription
ResultFPubnubOperationResultThe result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
PageFPubnubPagePagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).
FOnPubnubRemoveChannelMembersResponseNative​
FieldTypeDescription
Resultconst FPubnubOperationResult&The result of the operation.
MembersDataconst TArray<FPubnubChannelMemberData>&Array of FPubnubChannelMemberData structs which are the members of the channel.
Pageconst FPubnubPage&Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCountintTotal number of members matching the request (when requested).

Other examples​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.
Remove channel members with result​
Actor.h​
1

Actor.cpp​
1

Remove channel members with lambda​
Actor.h​
1

Actor.cpp​
1

Remove channel members raw​
Actor.h​
1

Actor.cpp​
1

Complete example​

Reference code
Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code.

ASample_AppContextFull.h​

1

ASample_AppContextFull.cpp​

1

Deprecated methods​

Get metadata for all users (deprecated)​

Deprecated

Use PubnubClient->GetAllUserMetadata / GetAllUserMetadataAsync instead.

Old signature: PubnubSubsystem->GetAllUserMetadata(FOnGetAllUserMetadataResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, UsersData, PageNext, PagePrev).

Get user metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->GetUserMetadata / GetUserMetadataAsync instead.

Old signature: PubnubSubsystem->GetUserMetadata(User, FOnGetUserMetadataResponse, Include);

Set user metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->SetUserMetadata / SetUserMetadataAsync with FPubnubUserInputData instead.

Old signature: PubnubSubsystem->SetUserMetadata(User, FPubnubUserData UserMetadata, FOnSetUserMetadataResponse, Include);

Remove user metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->RemoveUserMetadata / RemoveUserMetadataAsync instead.

Old signature: PubnubSubsystem->RemoveUserMetadata(User, FOnRemoveUserMetadataResponse);

Get metadata for all channels (deprecated)​

Deprecated

Use PubnubClient->GetAllChannelMetadata / GetAllChannelMetadataAsync instead.

Old signature: PubnubSubsystem->GetAllChannelMetadata(FOnGetAllChannelMetadataResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, ChannelsData, PageNext, PagePrev).

Get channel metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->GetChannelMetadata / GetChannelMetadataAsync instead.

Old signature: PubnubSubsystem->GetChannelMetadata(Include, Channel, FOnGetChannelMetadataResponse);

Set channel metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->SetChannelMetadata / SetChannelMetadataAsync with FPubnubChannelInputData instead.

Old signature: PubnubSubsystem->SetChannelMetadata(Channel, FPubnubChannelData ChannelMetadata, FOnSetChannelMetadataResponse, Include);

Remove channel metadata - PubNub client (deprecated)​

Deprecated

Use PubnubClient->RemoveChannelMetadata / RemoveChannelMetadataAsync instead.

Old signature: PubnubSubsystem->RemoveChannelMetadata(Channel, FOnRemoveChannelMetadataResponse);

Get channel memberships (deprecated)​

Deprecated

Use PubnubClient->GetMemberships / GetMembershipsAsync instead.

Old signature: PubnubSubsystem->GetMemberships(User, FOnGetMembershipsResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembershipsData, PageNext, PagePrev).

Set channel memberships (deprecated)​

Deprecated

Use PubnubClient->SetMemberships / SetMembershipsAsync instead.

Old signature: PubnubSubsystem->SetMemberships(User, Channels, FOnSetMembershipsResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembershipsData, PageNext, PagePrev).

Remove Channel Memberships (deprecated)​

Deprecated

Use PubnubClient->RemoveMemberships / RemoveMembershipsAsync instead.

Old signature: PubnubSubsystem->RemoveMemberships(User, Channels, FOnRemoveMembershipsResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembershipsData, PageNext, PagePrev).

Get channel members (deprecated)​

Deprecated

Use PubnubClient->GetChannelMembers / GetChannelMembersAsync instead.

Old signature: PubnubSubsystem->GetChannelMembers(Channel, FOnGetChannelMembersResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembersData, PageNext, PagePrev).

Set channel members (deprecated)​

Deprecated

Use PubnubClient->SetChannelMembers / SetChannelMembersAsync instead.

Old signature: PubnubSubsystem->SetChannelMembers(Channel, Users, FOnSetChannelMembersResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembersData, PageNext, PagePrev).

Remove Channel Members (deprecated)​

Deprecated

Use PubnubClient->RemoveChannelMembers / RemoveChannelMembersAsync instead.

Old signature: PubnubSubsystem->RemoveChannelMembers(Channel, Users, FOnRemoveChannelMembersResponse, Include, Limit, Filter, Sort, PageNext, PagePrev); — delegate returned (Result, MembersData, PageNext, PagePrev).

Was this page useful?

Last updated on