---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/join
title: Join channels
updated_at: 2026-05-19T12:10:27.437Z
---

> 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


# Join channels

:::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.
:::

Create a channel membership for the current user with `JoinChannel()`. This records the user as a channel member and returns the created `Membership` object.

:::warning Two-step pattern
`JoinChannel()` only creates the membership. To start receiving messages, you must also call [Connect()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/watch) separately.
:::

:::tip Method naming
Earlier versions used `Join()` to create a membership and automatically start listening for messages. `JoinChannel()` supersedes `Join()` by separating membership creation from message subscription. `Join()` remains available but is deprecated.
:::

## Method signature

This method has the following signature:

```csharp
channel.JoinChannel(ChatMembershipData? membershipData = null)
```

### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| membershipData | ChatMembershipData | Optional | `null` | Optional membership metadata (custom data, status, type). |

### Output

| Type | Description |
| --- | --- |
| `Task<ChatOperationResult<Membership>>` | Returned `Task` containing the created [Membership](https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/membership) object. |

## Sample code

Join the `support` channel and start receiving messages.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// reference the "channel" object
var channelResult = await chat.GetChannel("support");
if (channelResult.Error)
{
    Debug.Log("Couldn't find channel!");
    return;
}
var channel = channelResult.Result;

channel.OnMessageReceived += OnMessageReceivedHandler; // or use lambda

void OnMessageReceivedHandler(Message message)
{
    Debug.Log($"Message received: {message.MessageText}");
}

// join the channel and add metadata to the newly created membership
await channel.JoinChannel();
// connect to start receiving messages in OnMessageReceived
channel.Connect();
```