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.
Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
-
Asynchronous methods (
Asyncsuffix) returnvoidand 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
Nativesuffix (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
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| Parameter | Description |
|---|---|
OnGetAllUserMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetAllUserMetadataResponseNative to handle the result using a lambda. |
IncludeType: FPubnubGetAllInclude | A list of property names to include in the response. |
LimitType: int | Number of objects to return. Default/Max: 100. |
FilterType: FString | Filter expression. Only matching objects are returned. See filtering. |
SortType: FPubnubGetAllSort | Sort by id, name, updated with asc/desc for sort direction (for example, {name: 'asc'}). |
PageType: FPubnubPage | Cursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page. |
FPubnubGetAllInclude
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
ACTION REQUIRED before running the code.Other examples
Reference code
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
- Synchronous: returns
FPubnubGetAllUserMetadataResult(Result, UsersData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubGetAllUserMetadataResponsereceives (Result, UsersData, Page, TotalCount).
FPubnubGetAllUserMetadataResult
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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);
| Parameter | Description |
|---|---|
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. |
Include | List of property names to include in the response. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
This function is void, but the delegate returns the FOnGetUserMetadataResponse struct.
Other examples
Reference code
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);
| Parameter | Description |
|---|---|
User *Type: FString | The metadata ID for which to retrieve the user object. Can't be empty. |
OnGetUserMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetUserMetadataResponseNative to handle the result using a lambda. |
Include | List of property names to include in the response. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubUserMetadataResult(Result, UserData). - Asynchronous: delegate
FOnPubnubGetUserMetadataResponsereceives (Result, UserData).
FPubnubUserMetadataResult
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
UserData | FPubnubUserData | The user with their associated User metadata. |
FOnPubnubGetUserMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
UserData | FPubnubUserData | The user with their associated User metadata. |
FOnPubnubGetUserMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
UserData | const FPubnubUserData& | The user with their associated User metadata. |
Other examples
Reference code
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
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:
- Get the existing metadata and store it locally.
- Append the new custom metadata to the existing one.
- 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);
| Parameter | Description |
|---|---|
UserMetadataType: FPubnubUserData | The user metadata object to create. |
FOnSetUserMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnSetUserMetadataResponseNative to handle the result using a lambda. |
Include | List 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
ACTION REQUIRED before running the code.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
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:
- Get the existing metadata and store it locally.
- Append the new custom metadata to the existing one.
- 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);
| Parameter | Description |
|---|---|
User *Type: FString | The metadata ID for which to set the user object. Can't be empty. |
UserMetadata *Type: FPubnubUserInputData | The user metadata to set (input struct; supports ForceSet for partial updates). |
OnSetUserMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubSetUserMetadataResponseNative to handle the result using a lambda. |
Include | List 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
| Field | Type | Description |
|---|---|---|
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
- Synchronous: returns
FPubnubUserMetadataResult(Result, UserData). - Asynchronous: delegate
FOnPubnubSetUserMetadataResponsereceives (Result, UserData).
FOnPubnubSetUserMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
UserData | FPubnubUserData | The user metadata object that was set. |
FOnPubnubSetUserMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
UserData | const FPubnubUserData& | The user metadata object that was set. |
Sample code
Reference code
ACTION REQUIRED before running the code.Other examples
Reference code
ACTION REQUIRED before running the code.Set metadata for a user with result
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
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);
| Parameter | Description |
|---|---|
OnRemoveUserMetadataResponse | The 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
ACTION REQUIRED before running the code.Returns
This function is void, but the delegate returns the FOnRemoveUserMetadataResponse struct.
Other examples
Reference code
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);
| Parameter | Description |
|---|---|
User *Type: FString | The metadata ID to delete from the user object. Can't be empty. |
OnRemoveUserMetadataResponse | The 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
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubOperationResult. - Asynchronous: delegate
FOnPubnubRemoveUserMetadataResponsereceives Result only.
FOnPubnubRemoveUserMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
FOnPubnubRemoveUserMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
Other examples
Reference code
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| Parameter | Description |
|---|---|
OnGetAllChannelMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetAllChannelMetadataResponseNative to handle the result using a lambda. |
IncludeType: FPubnubGetAllInclude | A list of property names to include in the response. |
LimitType: int | Number of objects to return. Default/Max: 100. |
FilterType: FString | Filter expression. Only matching objects are returned. See filtering. |
SortType: FPubnubGetAllSort | Sort by id, name, updated with asc/desc for sort direction (for example, {name: 'asc'}). |
PageType: FPubnubPage | Cursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubGetAllChannelMetadataResult(Result, ChannelsData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubGetAllChannelMetadataResponsereceives (Result, ChannelsData, Page, TotalCount).
FPubnubGetAllChannelMetadataResult
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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
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);
| Parameter | Description |
|---|---|
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. |
Include | List of property names to include in the response. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
This function is void, but the delegate returns the FOnGetChannelMetadataResponse struct.
Other examples
Reference code
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);
| Parameter | Description |
|---|---|
Channel *Type: FString | The channel ID for which to retrieve the channel object. Can't be empty. |
OnGetChannelMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetChannelMetadataResponseNative to handle the result using a lambda. |
Include | List of property names to include in the response. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubChannelMetadataResult(Result, ChannelData). - Asynchronous: delegate
FOnPubnubGetChannelMetadataResponsereceives (Result, ChannelData).
FPubnubChannelMetadataResult
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
ChannelData | FPubnubChannelData | The channel with its associated metadata. |
FOnPubnubGetChannelMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
ChannelData | FPubnubChannelData | The channel with its associated metadata. |
FOnPubnubGetChannelMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
ChannelData | const FPubnubChannelData& | The channel with its associated metadata. |
Other examples
Reference code
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
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:
- Get the existing metadata and store it locally.
- Append the new custom metadata to the existing one.
- 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);
| Parameter | Description |
|---|---|
ChannelMetadataType: FPubnubChannelData | The channel metadata object to create. |
FOnSetChannelMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnSetChannelMetadataResponseNative to handle the result using a lambda. |
Include | List 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
ACTION REQUIRED before running the code.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
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:
- Get the existing metadata and store it locally.
- Append the new custom metadata to the existing one.
- 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);
| Parameter | Description |
|---|---|
Channel *Type: FString | The metadata ID for which to set the channel object. Can't be empty. |
ChannelMetadata *Type: FPubnubChannelInputData | The channel metadata to set (input struct; supports ForceSet for partial updates). |
OnSetChannelMetadataResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubSetChannelMetadataResponseNative to handle the result using a lambda. |
Include | List 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
- Synchronous: returns
FPubnubChannelMetadataResult(Result, ChannelData). - Asynchronous: delegate
FOnPubnubSetChannelMetadataResponsereceives (Result, ChannelData).
FOnPubnubSetChannelMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
ChannelData | FPubnubChannelData | The channel metadata object that was set. |
FOnPubnubSetChannelMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
ChannelData | const FPubnubChannelData& | The channel metadata object that was set. |
Sample code
Reference code
ACTION REQUIRED before running the code.Other examples
Reference code
ACTION REQUIRED before running the code.Set metadata for a channel with result
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
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);
| Parameter | Description |
|---|---|
OnRemoveChannelMetadataResponse | The 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
ACTION REQUIRED before running the code.Returns
This function is void, but the delegate returns the FOnRemoveChannelMetadataResponse struct.
Other examples
Reference code
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);
| Parameter | Description |
|---|---|
Channel *Type: FString | The metadata ID to delete from the channel object. Can't be empty. |
OnRemoveChannelMetadataResponse | The 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
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubOperationResult. - Asynchronous: delegate
FOnPubnubRemoveChannelMetadataResponsereceives Result only.
FOnPubnubRemoveChannelMetadataResponse
| Field | Type | Description |
|---|---|---|
Result | FPubnubOperationResult | The result of the operation. |
FOnPubnubRemoveChannelMetadataResponseNative
| Field | Type | Description |
|---|---|---|
Result | const FPubnubOperationResult& | The result of the operation. |
Other examples
Reference code
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| Parameter | Description |
|---|---|
User *Type: FString | The user UUID for whom to retrieve memberships. |
OnGetMembershipsResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetMembershipsResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMembershipInclude | List of property names to include in the response. |
LimitType: int | Number of objects to return. Default/Max: 100. |
FilterType: FString | Filter expression. Only matching objects are returned. See filtering. |
SortType: FPubnubMembershipSort | Key-value pair of a property to sort by, and a sort direction. |
PageType: FPubnubPage | Cursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page. |
FPubnubMembershipInclude
| Field Name | Type | Default Value | Description |
|---|---|---|---|
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 Name | Type | Description |
|---|---|---|
MembershipSort | TArray<FPubnubMembershipSingleSort> | Array of sort criteria used in Membership-related functions. Order matters (applied in sequence). |
FPubnubMembershipSingleSort
| Field Name | Type | Default | Description |
|---|---|---|---|
| SortType | EPubnubMembershipSortType | EPubnubMembershipSortType::PMST_ChannelID | Field to sort by in the Membership context |
| SortOrder | bool | false | Ascending when false, descending when true |
EPubnubMembershipSortType
| Enum Value | Display Name | Description |
|---|---|---|
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
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubMembershipsResult(Result, MembershipsData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubGetMembershipsResponsereceives (Result, MembershipsData, Page, TotalCount).
FPubnubMembershipsResult
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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| Parameter | Description |
|---|---|
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. |
OnSetMembershipsResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubSetMembershipsResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMembershipInclude | List of property names to include in the response. |
LimitType: int | The maximum number of memberships to return. |
FilterType: FString | The filter to apply to the memberships. |
SortType: FPubnubMembershipSort | The sort order to apply to the memberships. |
PageType: FPubnubPage | Cursor-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
| Field | Type | Description |
|---|---|---|
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
- Synchronous: returns
FPubnubMembershipsResult(Result, MembershipsData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubSetMembershipsResponsereceives (Result, MembershipsData, Page, TotalCount).
FOnPubnubSetMembershipsResponse
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
ACTION REQUIRED before running the code.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
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| Parameter | Description |
|---|---|
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. |
OnRemoveMembershipsResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubRemoveMembershipsResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMembershipInclude | List of property names to include in the response. |
LimitType: int | The maximum number of memberships to return. |
FilterType: FString | The filter to apply to the memberships. |
SortType: FPubnubMembershipSort | The sort order to apply to the memberships. |
PageType: FPubnubPage | Cursor-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
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubMembershipsResult(Result, MembershipsData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubRemoveMembershipsResponsereceives (Result, MembershipsData, Page, TotalCount).
FOnPubnubRemoveMembershipsResponse
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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| Parameter | Description |
|---|---|
Channel *Type: FString | The Channel ID for which to retrieve members. |
OnGetChannelMembersResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubGetChannelMembersResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMemberInclude | List of property names to include in the response. |
LimitType: int | Number of objects to return. Default/Max: 100. |
FilterType: FString | Expression used to filter the results. Check online documentation to see exact filter formulas. |
SortType: FPubnubMemberSort | Key-value pair of a property to sort by, and a sort direction. |
PageType: FPubnubPage | Cursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page. |
FPubnubMemberInclude
| Field Name | Type | Default | Description |
|---|---|---|---|
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 Name | Type | Description |
|---|---|---|
MemberSort | TArray<FPubnubMemberSingleSort> | Array of sort criteria used in Member-related functions. Order matters (applied in sequence). |
FPubnubMemberSingleSort
| Field Name | Type | Default | Description |
|---|---|---|---|
| SortType | EPubnubMemberSortType | EPubnubMemberSortType::PMeST_UserID | Field to sort by in the Member context |
| SortOrder | bool | false | Ascending when false, descending when true |
EPubnubMemberSortType
| Enum Value | Display Name | Description |
|---|---|---|
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
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubChannelMembersResult(Result, MembersData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubGetChannelMembersResponsereceives (Result, MembersData, Page, TotalCount).
FPubnubChannelMembersResult
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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| Parameter | Description |
|---|---|
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. |
OnSetChannelMembersResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubSetChannelMembersResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMemberInclude | List of property names to include in the response. |
LimitType: int | The maximum number of members to return. |
FilterType: FString | The filter to apply to the members. |
SortType: FPubnubMemberSort | The sort order to apply to the members. |
PageType: FPubnubPage | Cursor-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
| Field | Type | Description |
|---|---|---|
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
- Synchronous: returns
FPubnubChannelMembersResult(Result, MembersData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubSetChannelMembersResponsereceives (Result, MembersData, Page, TotalCount).
FOnPubnubSetChannelMembersResponse
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
ACTION REQUIRED before running the code.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
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| Parameter | Description |
|---|---|
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. |
OnRemoveChannelMembersResponse | The delegate for the operation's result. You can also use a native callback of the type FOnPubnubRemoveChannelMembersResponseNative to handle the result using a lambda. |
IncludeType: FPubnubMemberInclude | List of property names to include in the response. |
LimitType: int | The maximum number of members to return. |
FilterType: FString | The filter to apply to the members. |
SortType: FPubnubMemberSort | The sort order to apply to the members. |
PageType: FPubnubPage | Cursor-based pagination. Use Page.Next and Page.Prev to request the next or previous page. |
Sample code
Reference code
ACTION REQUIRED before running the code.Returns
- Synchronous: returns
FPubnubChannelMembersResult(Result, MembersData, Page, TotalCount). - Asynchronous: delegate
FOnPubnubRemoveChannelMembersResponsereceives (Result, MembersData, Page, TotalCount).
FOnPubnubRemoveChannelMembersResponse
| Field | Type | Description |
|---|---|---|
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
| Field | Type | Description |
|---|---|---|
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
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
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).