On this page

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
IncludeCustom
bool
Whether to include the Custom object in the response.
IncludeStatus
bool
Whether to include the membership Status field.
IncludeType
bool
Whether to include the membership Type field.
IncludeTotalCount
bool
Whether to include the total count.

FPubnubGetAllSort

FieldTypeDescription
GetAllSort
TArray<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
Result
FPubnubOperationResult
The result of the operation.
UsersData
TArray<FPubnubUserData>
Array of FPubnubUserData structs which are the users with their associated User metadata.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of users matching the request (when requested).
FOnPubnubGetAllUserMetadataResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
UsersData
const TArray<FPubnubUserData>&
Array of FPubnubUserData structs which are the users with their associated User metadata.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of users matching the request (when requested).
FPubnubPage

FieldTypeDescription
Next
FString
Cursor for forward pagination. Use in the next request to fetch the following page.
Prev
FString
Cursor for backward pagination. Use in the next request to fetch the previous page. Ignored if Next is supplied.
FPubnubUserData

FieldTypeDescription
UserID
FString
UUID. If not supplied, the current user's UUID is used.
UserName
FString
Display name for the user.
ExternalID
FString
User's identifier in an external system.
ProfileUrl
FString
The URL of the user's profile picture.
Email
FString
The user's email address.
Custom
FString
Custom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
Status
FString
User status. Max. 50 characters.
Type
FString
User type. Max. 50 characters.
Updated
FString
The date when the user's metadata was last updated.
ETag
FString
Information on the object's content fingerprint.
FOnPubnubGetAllUserMetadataResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
UsersData
const TArray<FPubnubUserData>&
Array of FPubnubUserData structs which are the users with their associated User metadata.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
Result
FPubnubOperationResult
The result of the operation.
UserData
FPubnubUserData
The user with their associated User metadata.
FOnPubnubGetUserMetadataResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
UserData
FPubnubUserData
The user with their associated User metadata.
FOnPubnubGetUserMetadataResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
UserData
const 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
IncludeCustom
bool
Whether to include the object's Custom field.
IncludeStatus
bool
Whether to include the object's Status field.
IncludeType
bool
Whether to include the object's Type field.

Returns

FOnPubnubSetUserMetadataResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
UserData
FPubnubUserData
The user metadata object that was set.

FOnPubnubSetUserMetadataResponseNative

FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
UserData
const 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
Result
FPubnubOperationResult
The result of the operation.
FOnPubnubRemoveUserMetadataResponseNative
FieldTypeDescription
Result
const 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
Result
FPubnubOperationResult
The result of the operation.
ChannelsData
TArray<FPubnubChannelData>
Array of FPubnubChannelData structs which are the channels with their associated metadata.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of channels matching the request (when requested).
FOnPubnubGetAllChannelMetadataResponse
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
ChannelsData
const TArray<FPubnubChannelData>&
Array of FPubnubChannelData structs which are the channels with their associated metadata.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of channels matching the request (when requested).
FPubnubChannelData
FieldTypeDescription
ChannelID
FString
ID of the channel.
ChannelName
FString
Name of the channel.
Description
FString
Additional description of the channel.
Custom
FString
Custom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
Status
FString
Channel status. Max 50 characters.
Type
FString
Channel type. Max 50 characters.
Updated
FString
The date when the channel's metadata was last updated.
ETag
FString
Version identifier of the user's metadata.
FOnPubnubGetAllChannelMetadataResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
ChannelsData
const TArray<FPubnubChannelData>&
Array of FPubnubChannelData structs which are the channels with their associated metadata.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
Result
FPubnubOperationResult
The result of the operation.
ChannelData
FPubnubChannelData
The channel with its associated metadata.
FOnPubnubGetChannelMetadataResponse
FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
ChannelData
FPubnubChannelData
The channel with its associated metadata.
FOnPubnubGetChannelMetadataResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
ChannelData
const 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
Result
FPubnubOperationResult
The result of the operation.
ChannelData
FPubnubChannelData
The channel metadata object that was set.

FOnPubnubSetChannelMetadataResponseNative

FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
ChannelData
const 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
Result
FPubnubOperationResult
The result of the operation.
FOnPubnubRemoveChannelMetadataResponseNative
FieldTypeDescription
Result
const 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
IncludeCustom
bool
false
Whether to include the membership's Custom field.
IncludeStatus
bool
false
Whether to include the membership's Status field.
IncludeType
bool
false
Whether to include the membership's Type field.
IncludeChannel
bool
false
Whether to include the membership's Channel data field (in form of FPubnubChannelData).
IncludeChannelCustom
bool
false
Whether to include the membership's Channel Custom field.
IncludeChannelStatus
bool
false
Whether to include the membership's Channel Status field
IncludeChannelType
bool
false
Whether to include the membership's Channel Type field
IncludeTotalCount
bool
false
Whether to include the total count of memberships

FPubnubMembershipSort

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

FPubnubMembershipSingleSort

Field NameTypeDefaultDescription
SortType
EPubnubMembershipSortType
EPubnubMembershipSortType::PMST_ChannelID
Field to sort by in the Membership context
SortOrder
bool
false
Ascending when false, descending when true

EPubnubMembershipSortType

Enum ValueDisplay NameDescription
PMST_ChannelID
ChannelID
Sort by Channel ID
PMST_ChannelName
ChannelName
Sort by Channel Name
PMST_ChannelUpdated
ChannelUpdated
Sort by last update to the Channel
PMST_ChannelStatus
ChannelStatus
Sort by Channel Status
PMST_ChannelType
ChannelType
Sort by Channel Type
PMST_Updated
Updated
Sort by Membership update timestamp
PMST_Status
Status
Sort by Membership status
PMST_Type
Type
Sort 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
Result
FPubnubOperationResult
The result of the operation.
MembershipsData
TArray<FPubnubMembershipData>
Array of FPubnubMembershipData structs which are the memberships.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of memberships matching the request (when requested).
FOnPubnubGetMembershipsResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of memberships matching the request (when requested).
FPubnubMembershipData

FieldTypeDescription
Channel
FPubnubChannelData
Contains channel metadata, including unique channel identifier and other relevant information.
Custom
FString
Custom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn’t supported.
Status
FString
Status of the membership. Max 50 characters.
Type
FString
Type of the membership. Max 50 characters.
Updated
FString
The date when the channel's membership was last updated.
ETag
FString
Version identifier of the membership metadata.
FOnPubnubGetMembershipsResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
Channel
FString
The channel ID to add/update the membership. Can't be empty.
Custom
FString
The custom data to add/update the membership.
Status
FString
The status of the membership.
Type
FString
The type of the membership.

Returns

FOnPubnubSetMembershipsResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of memberships matching the request (when requested).

FOnPubnubSetMembershipsResponseNative

FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
Result
FPubnubOperationResult
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of memberships matching the request (when requested).
FOnPubnubRemoveMembershipsResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembershipsData
const TArray<FPubnubMembershipData>&
Array of FPubnubMembershipData structs which are the memberships.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
IncludeCustom
bool
false
Whether to include the member's Custom field
IncludeStatus
bool
false
Whether to include the member's Status field
IncludeType
bool
false
Whether to include the member's Type field
IncludeUUID
bool
false
Whether to include the member's User data (FPubnubUUIDMetadata)
IncludeUUIDCustom
bool
false
Whether to include the member's User Custom field
IncludeUUIDStatus
bool
false
Whether to include the member's User Status field
IncludeUUIDType
bool
false
Whether to include the member's User Type field
IncludeTotalCount
bool
false
Whether to include the total count of paginated records

FPubnubMemberSort

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

FPubnubMemberSingleSort

Field NameTypeDefaultDescription
SortType
EPubnubMemberSortType
EPubnubMemberSortType::PMeST_UserID
Field to sort by in the Member context
SortOrder
bool
false
Ascending when false, descending when true

EPubnubMemberSortType

Enum ValueDisplay NameDescription
PMeST_UserID
UserID
Sort by Member's User ID
PMeST_UserName
UserName
Sort by Member's User Name
PMeST_UserUpdated
UserUpdated
Sort by when the User was updated
PMeST_UserStatus
UserStatus
Sort by User Status
PMeST_UserType
UserType
Sort by User Type
PMeST_Updated
Updated
Sort by Member record update timestamp
PMeST_Status
Status
Sort by Member Status
PMeST_Type
Type
Sort 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
Result
FPubnubOperationResult
The result of the operation.
MembersData
TArray<FPubnubChannelMemberData>
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of members matching the request (when requested).
FOnPubnubGetChannelMembersResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of members matching the request (when requested).
FPubnubChannelMemberData

FieldTypeDescription
User
FPubnubUserData
Contains user metadata, including unique user identifier and other relevant information.
Custom
FString
Custom JSON values. Can be strings, numbers, or booleans. Filtering by Custom isn't supported.
Status
FString
Status of the member. Max 50 characters.
Type
FString
Type of the member. Max 50 characters.
Updated
FString
The date when the channel's member was last updated.
ETag
FString
Version identifier of the member metadata.
FOnPubnubGetChannelMembersResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
User
FString
The user UUID to add/update the membership. Can't be empty.
Custom
FString
The custom data to add/update the membership.
Status
FString
The status of the membership.
Type
FString
The type of the membership.

Returns

FOnPubnubSetChannelMembersResponse

FieldTypeDescription
Result
FPubnubOperationResult
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of members matching the request (when requested).

FOnPubnubSetChannelMembersResponseNative

FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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
Result
FPubnubOperationResult
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
FPubnubPage
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total number of members matching the request (when requested).
FOnPubnubRemoveChannelMembersResponseNative
FieldTypeDescription
Result
const FPubnubOperationResult&
The result of the operation.
MembersData
const TArray<FPubnubChannelMemberData>&
Array of FPubnubChannelMemberData structs which are the members of the channel.
Page
const FPubnubPage&
Pagination cursor (Next, Prev) for requesting the next or previous page.
TotalCount
int
Total 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).

Last updated on