---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/membership
title: Manage the user-channel membership relation
updated_at: 2026-06-19T11:35:26.617Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Manage the user-channel membership relation

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) for your keyset in the [Admin Portal](https://admin.pubnub.com/).
:::

A [Membership entity](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) is created when a user [joins](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/join) or is [invited](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/invite) to a channel, and ends when the user [leaves](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/leave).

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

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

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

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

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

:::note Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
* Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes. 1Channel->GetMembersAsync(OnGetMembersResponseDelegate); You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatMembershipsResponseNative).
* Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly. 1FPubnubChatMembershipsResult Result = Channel->GetMembers();
:::

## Get members

Get all members of a channel with `GetMembers()`.

### Method signature

#### Blueprint

#### C++ / Input parameters

```cpp
Channel->GetMembers(
    int Limit = 0, 
    FString Filter = "", 
    FPubnubMemberSort Sort = ..., 
    FPubnubPage Page = FPubnubPage()
);
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Limit | int | Optional | `0` | Number of objects to return in response. The default (and maximum) value is `100`. |
| Filter | FString | Optional | `""` | Expression used to filter the results. Returns only these channels whose properties satisfy the given expression are returned. The filter language is [defined here](https://www.pubnub.com/docs/general/metadata/filtering). |
| Sort | FPubnubMemberSort | Optional |  | Struct used to specify a property to sort by and sort direction. Available options are `id`, `name`, and `updated`. Use `asc` or `desc` to specify the sorting direction. By default, the items are sorted by the last updated date. |
| Page | FPubnubPage | Optional | `FPubnubPage()` | Object used for pagination to define which previous or next result page you want to fetch. |
| > Next | FString | Optional |  | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| > Prev | FString | Optional |  | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatMembershipsResult`Type: `struct` | Returned object containing these fields: `Result`, `Memberships`, `Page`, and `Total`. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> Memberships`Type: `TArray<UPubnubChatMembership*>` | Array of all related memberships. |
| `> Page`Type: `FPubnubPage` | Object used for pagination to define which previous or next result page you want to fetch. |
| `>> Next`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `>> Prev`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |
| `> Total`Type: `int` | Total number of channel members. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Get channel members with user data asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint.hddmgqh9
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatChannel")
void GetMembersSample();

UFUNCTION()
void OnGetMembersResponse(const FPubnubChatMembershipsResult& Result);
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::GetMembersSample()
{
	// snippet.hide
	UPubnubChatChannel* Channel = nullptr;
	// snippet.show

	// Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel)

	// Callback for when the operation completes (returns memberships with user data)
	FOnPubnubChatMembershipsResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnGetMembersResponse);
	Channel->GetMembersAsync(Callback);
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnGetMembersResponse(const FPubnubChatMembershipsResult& Result)
{
	if (Result.Result.Error) { return; }
	TArray<UPubnubChatMembership*> Memberships = Result.Memberships;
}
```

###### Blueprint

## Get member

Get a specific channel member by user ID with `GetMember()`.

### Method signature

#### C++ / Input parameters

```cpp
Channel->GetMember(const FString UserID);
```

| Parameter | Description |
| --- | --- |
| `UserID` *Type: `FString`Default: n/a | Unique identifier of the user to retrieve the membership for. |

#### Blueprint

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatMembershipResult`Type: `struct` | Returned object containing `Result` and `Membership`. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> Membership`Type: `UPubnubChatMembership*` | Membership of the specified user, or `nullptr` if they are not a member. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Get the membership of a user on the current channel.

###### Actor.h

```cpp
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatChannel")
void GetMemberSample();

UFUNCTION()
void OnGetMemberResponse(const FPubnubChatMembershipResult& Result);
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::GetMemberSample()
{
	// snippet.hide
	UPubnubChatChannel* Channel = nullptr;
	// snippet.show

	// Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel)

	// User ID to query member for
	FString UserID = TEXT("user-abc123");

	// Callback for when the operation completes (returns one membership or empty)
	FOnPubnubChatMembershipResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnGetMemberResponse);
	Channel->GetMemberAsync(UserID, Callback);
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnGetMemberResponse(const FPubnubChatMembershipResult& Result)
{
	if (Result.Result.Error) { return; }
	UPubnubChatMembership* Membership = Result.Membership;
}
```

## Check member

Check if a specific user is a member of the channel with `HasMember()`.

### Method signature

#### C++ / Input parameters

```cpp
Channel->HasMember(const FString UserID);
```

| Parameter | Description |
| --- | --- |
| `UserID` *Type: `FString`Default: n/a | Unique identifier of the user to check. |

#### Blueprint

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatHasMemberResult`Type: `struct` | Returned object containing `Result` and `HasMember`. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> HasMember`Type: `bool` | `true` if the user is a member of the channel; `false` otherwise. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Check if a user is a member of the current channel.

###### Actor.h

```cpp
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatChannel")
void HasMemberSample();

UFUNCTION()
void OnHasMemberResponse(const FPubnubChatHasMemberResult& Result);
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::HasMemberSample()
{
	// snippet.hide
	UPubnubChatChannel* Channel = nullptr;
	// snippet.show

	// Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel)

	// User ID to check membership for
	FString UserID = TEXT("user-abc123");

	// Callback for when the operation completes (returns true if user is a member)
	FOnPubnubChatHasMemberResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnHasMemberResponse);
	Channel->HasMemberAsync(UserID, Callback);
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnHasMemberResponse(const FPubnubChatHasMemberResult& Result)
{
	if (Result.Result.Error) { return; }
	bool bHasMember = Result.HasMember;
}
```

## Get membership

Get all channel [memberships](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) for a user with `GetMemberships()`.

To list all channels, use [GetChannels()](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/list) instead.

### C++ / Input parameters

```cpp
User->GetMemberships(
    const int Limit = 0,
    const FString Filter = "",
    FPubnubMembershipSort Sort = FPubnubMembershipSort(),
    FPubnubPage Page = FPubnubPage()
);
```

| Parameter | Description |
| --- | --- |
| `Limit`Type: `int`Default: `0` | Number of objects to return in response. Pass 0 to use the server default. |
| `Filter`Type: `FString`Default: `""` | Expression used to filter the results. Returns only these channels whose properties satisfy the given expression. The filter language is [defined here](https://www.pubnub.com/docs/general/metadata/filtering). |
| `Sort`Type: `FPubnubMembershipSort`Default: n/a | Struct defining the property to sort by, and a sort direction. Available options are `id`, `name`, and `updated`. |
| `Page`Type: `FPubnubPage`Default: n/a | Object used for pagination to define which previous or next result page you want to fetch. |
| `> Next`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `> Prev`Type: `FString`Default: n/a | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |

### Blueprint

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatMembershipsResult`Type: `struct` | Returned object containing these fields: `Page`, `Total`, `Result`, and `Memberships`. |
| `> Page`Type: `FPubnubPage` | Object used for pagination to define which previous or next result page you want to fetch. |
| `>> Next`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `>> Prev`Type: `FString` | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `Next` parameter is supplied. |
| `> Total`Type: `int` | Total number of channel members. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> Memberships`Type: `TArray<UPubnubChatMembership*>` | Array of all related memberships. |

### Sample code

Find out which channels the `support_agent_15` user is a member of.

#### C++

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

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

	// Callback for when the operation completes (returns memberships with channel data)
	FOnPubnubChatMembershipsResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatUser::OnGetMembershipsResponse);
	User->GetMembershipsAsync(Callback);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnGetMembershipsResponse(const FPubnubChatMembershipsResult& Result)
{
	if (Result.Result.Error) { return; }
	TArray<UPubnubChatMembership*> Memberships = Result.Memberships;
}
```

#### Blueprint

## Get single membership

Get a user's [membership](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) on a specific channel with `GetMembership()`.

### Method signature

#### C++ / Input parameters

```cpp
User->GetMembership(const FString ChannelID);
```

| Parameter | Description |
| --- | --- |
| `ChannelID` *Type: `FString`Default: n/a | ID of the channel to retrieve the user's membership for. |

#### Blueprint

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatMembershipResult`Type: `struct` | Returned object containing `Result` and `Membership`. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> Membership`Type: `UPubnubChatMembership*` | The user's membership on the specified channel, or `nullptr` if not a member. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Get the membership of a user on a specific channel.

###### Actor.h

```cpp
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatUser")
void GetMembershipSample();

UFUNCTION()
void OnGetMembershipResponse(const FPubnubChatMembershipResult& Result);
```

###### Actor.cpp

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

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

	// Channel ID to query membership for
	FString ChannelID = TEXT("lobby-01");

	// Callback for when the operation completes (returns one membership or empty)
	FOnPubnubChatMembershipResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatUser::OnGetMembershipResponse);
	User->GetMembershipAsync(ChannelID, Callback);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnGetMembershipResponse(const FPubnubChatMembershipResult& Result)
{
	if (Result.Result.Error) { return; }
	UPubnubChatMembership* Membership = Result.Membership;
}
```

## Check channel membership

Check if a user is a member of a specific channel with `IsMemberOn()`.

### Method signature

#### C++ / Input parameters

```cpp
User->IsMemberOn(const FString ChannelID);
```

| Parameter | Description |
| --- | --- |
| `ChannelID` *Type: `FString`Default: n/a | ID of the channel to check membership on. |

#### Blueprint

#### Output

| Parameter | Description |
| --- | --- |
| `FPubnubChatIsMemberOnResult`Type: `struct` | Returned object containing `Result` and `IsMemberOn`. |
| `> Result`Type: `FPubnubChatOperationResult` | Contains `Error` and `ErrorMessage` for operation status. |
| `> IsMemberOn`Type: `bool` | `true` if the user is a member of the specified channel; `false` otherwise. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Check if a user is a member of a specific channel.

###### Actor.h

```cpp
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatUser")
void IsMemberOnSample();

UFUNCTION()
void OnIsMemberOnResponse(const FPubnubChatIsMemberOnResult& Result);
```

###### Actor.cpp

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

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

	// Channel ID to check membership on
	FString ChannelID = TEXT("lobby-01");

	// Callback for when the operation completes (returns true if user is a member on channel)
	FOnPubnubChatIsMemberOnResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatUser::OnIsMemberOnResponse);
	User->IsMemberOnAsync(ChannelID, Callback);
}

// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::OnIsMemberOnResponse(const FPubnubChatIsMemberOnResult& Result)
{
	if (Result.Result.Error) { return; }
	bool bIsMemberOn = Result.IsMemberOn;
}
```

## Get updates

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

* `StreamUpdates()` - monitors a single membership
* `StreamUpdatesOn()` - monitors multiple memberships (static method)

Both methods return `FPubnubChatOperationResult`. Updates are delivered via the membership's `OnUpdated` delegate (with channel ID, user ID, and data) and deletions via the `OnDeleted` delegate. Bind these delegates before calling `StreamUpdates()` or `StreamUpdatesOn()`.

:::note Stream update behavior
* StreamUpdates() delivers updates via the membership's OnUpdated delegate (with channel ID, user ID, and data) and deletions via OnDeleted delegate.
* StreamUpdatesOn() delivers updates on any of the monitored memberships via the same delegate pattern.
* To stop receiving updates, call StopStreamingUpdates() or StopStreamingUpdatesAsync() on the membership.
:::

### Method signature

#### C++ / Input parameters

* StreamUpdates() 1Membership->StreamUpdates();
* StreamUpdatesOn() (static) 1UPubnubChatMembership::StreamUpdatesOn(const TArray<UPubnubChatMembership*>& Memberships);

#### Blueprint

| Parameter | Required in `StreamUpdates()` | Required in `StreamUpdatesOn()` | Description |
| --- | --- | --- | --- |
| `Memberships`Type: `TArray<UPubnubChatMembership*>`Default: n/a | No | Yes | Array of [Membership objects](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) for which you want to get updates. |

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Contains `Error` (bool) and `ErrorMessage` (FString). Check `Error` to determine if the operation succeeded. |

### Sample code

Stream updates on a membership and stop when no longer needed.

#### C++

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

	// Assumes Membership is a valid UPubnubChatMembership

	// Bind to receive membership updates and deletion events
	Membership->OnUpdatedNative.AddUObject(this, &ASample_ChatMembership::OnMembershipUpdateReceived);
	Membership->OnDeletedNative.AddUObject(this, &ASample_ChatMembership::OnMembershipDeleted);

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

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

// ACTION REQUIRED: Replace ASample_ChatMembership with name of your Actor class
void ASample_ChatMembership::OnMembershipUpdateReceived(FString ChannelID, FString UserID, const FPubnubChatMembershipData& MembershipData)
{
	/* e.g. refresh membership UI with updated metadata */
}

void ASample_ChatMembership::OnMembershipDeleted()
{
	/* e.g. remove membership from list */
}
```

#### Blueprint

### Stopping updates

To stop receiving membership updates, call `StopStreamingUpdates()` or `StopStreamingUpdatesAsync()` on the membership.

## Update

Update a user's channel [membership](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) information with `Update()`.

### Method signature

#### C++ / Input parameters

```cpp
Membership->Update(FPubnubChatUpdateMembershipInputData UpdateMembershipData);
```

| Type | Description |
| --- | --- |
| [FPubnubChatUpdateMembershipInputData](#fpubnubchatupdatemembershipinputdata) | The object containing the membership fields to update. |

##### FPubnubChatUpdateMembershipInputData

| Parameter | Description |
| --- | --- |
| `Custom`Type: `FString`Default: n/a | JSON custom data associated with the membership. |
| `Status`Type: `FString`Default: n/a | Status of the membership. |
| `Type`Type: `FString`Default: n/a | Type of the membership. |
| `ForceSetCustom`Type: `bool`Default: `false` | When `true`, overwrites the custom data even if empty. |
| `ForceSetStatus`Type: `bool`Default: `false` | When `true`, overwrites the status even if empty. |
| `ForceSetType`Type: `bool`Default: `false` | When `true`, overwrites the type even if empty. |

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Contains `Error` (bool) and `ErrorMessage` (FString). Check `Error` to determine if the operation succeeded. The membership is updated in place. |

### Sample code

Update a membership's status to `active`.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatMembership with name of your Actor class
void ASample_ChatMembership::UpdateMembershipSample()
{
	// snippet.hide
	UPubnubChatMembership* Membership = nullptr;
	// snippet.show

	// Assumes Membership is a valid UPubnubChatMembership

	// Fields to update for this membership (custom, status, type)
	FPubnubChatUpdateMembershipInputData UpdateData;
	UpdateData.Status = TEXT("active");

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

#### Blueprint

## Get membership data

`GetMembershipData()` returns the channel membership data for a given user.

### Method signature

#### C++ / Input parameters

```cpp
Membership->GetMembershipData();
```

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| [FPubnubChatMembershipData](#fpubnubchatmembershipdata) | The object containing all membership data. |

##### FPubnubChatMembershipData

| Parameter | Description |
| --- | --- |
| `Custom`Type: `FString` | Custom data associated with the membership. |
| `Status`Type: `FString` | Status of the membership. |
| `Type`Type: `FString` | Type of the membership. |

### Sample code

Get the membership data for a membership.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatMembership with name of your Actor class
void ASample_ChatMembership::GetMembershipDataSample()
{
	// snippet.hide
	UPubnubChatMembership* Membership = nullptr;
	// snippet.show

	// Assumes Membership is a valid UPubnubChatMembership

	// Get membership metadata from local cache (local, no network call)
	FPubnubChatMembershipData MembershipData = Membership->GetMembershipData();
	FString Status = MembershipData.Status;
}
```

#### Blueprint

## Other examples

These accessors return the user or channel associated with a membership. They are local getters and do not make network calls.

#### Get user

#### Get channel

#### Get user ID

#### Get channel ID

## Delete

Remove a user's channel [membership](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/membership) with `Delete()`. This removes the user from the channel's members on the server.

### Method signature

#### C++ / Input parameters

```cpp
Membership->Delete();
```

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Contains `Error` (bool) and `ErrorMessage` (FString). Check `Error` to determine if the operation succeeded. |

### Sample code

Delete a membership.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatMembership with name of your Actor class
void ASample_ChatMembership::DeleteMembershipSample()
{
	// snippet.hide
	UPubnubChatMembership* Membership = nullptr;
	// snippet.show

	// Assumes Membership is a valid UPubnubChatMembership

	// Remove this membership from the channel on the server
	Membership->DeleteAsync(nullptr);
}
```

#### Blueprint