---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/join
title: Join channels
updated_at: 2026-05-12T11:37:48.000Z
---

# Join channels

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

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

Use `Join()` to create a channel membership for the user. The user is recorded as a channel member.

:::note Receiving messages after joining
`Join()` creates the membership but does not subscribe to the channel. To start receiving messages, bind the channel's `OnMessageReceived` delegate and call [Connect()](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/watch.md) separately after `Join()` returns.
:::

##### 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.md#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.

   ```cpp
   #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.
   ```cpp
   Channel->JoinAsync(MembershipData, OnJoinResponseDelegate);
   ```
   You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the `Native` suffix (for example, `FOnPubnubChatJoinResponseNative`).
* **Synchronous** methods (no suffix) block the main game thread until the operation completes and return a result struct directly.
   ```cpp
   FPubnubChatJoinResult Result = Channel->Join(MembershipData);
   ```
:::

## Method signature

### C++ / Input parameters

```cpp
Channel->Join(
    FPubnubChatMembershipData MembershipData = FPubnubChatMembershipData()
);
```

### Blueprint

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| MembershipData | FPubnubChatMembershipData | Optional | `FPubnubChatMembershipData()` | The object containing all membership data. For more information, refer to [FPubnubChatMembershipData](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/channels/membership.md#fpubnubchatmembershipdata). |

### Output

| Type | Description |
| --- | --- |
| `FPubnubChatJoinResult` | Contains `Result` (`FPubnubChatOperationResult` with `Error`/`ErrorMessage`) and `Membership` (`UPubnubChatMembership*`). |

## Sample code

Join the `support` channel and mark this membership as `premium` to add information about your support plan.

### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::JoinSample()
{

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

	// Add listener for received messages before connecting
	Channel->OnMessageReceivedNative.AddUObject(this, &ASample_ChatChannel::OnChannelMessageReceived_JoinSample);

	// Join the channel to become a member (creates membership)
	FOnPubnubChatJoinResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnJoinResponse);
	Channel->JoinAsync(Callback);

	// Connect to start receiving messages (Join does not subscribe automatically)
	Channel->ConnectAsync(nullptr);

	// After some time when receiving messages is not needed anymore - disconnect
	Channel->Disconnect();
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnChannelMessageReceived_JoinSample(UPubnubChatMessage* Message)
{
	/* e.g. display in chat UI */
}

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

### Blueprint

Last updated at: 2026-05-12T11:37:48.000Z
