---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/watch
title: Watch / Unwatch channels
updated_at: 2026-06-15T09:14:08.953Z
---

> 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


# Watch / Unwatch channels

Use `Connect()` to receive messages on a channel without [joining](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/join) as a member. Use `Disconnect()` to stop receiving messages without [leaving](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/leave).

## Watch a channel

`Connect()` subscribes to a channel. After connecting, the `OnMessageReceived` event is triggered when a message is received. Handle this event to receive messages.

### Method signature

```csharp
channel.Connect()
```

### Event signature

```csharp
public event Action<Message> OnMessageReceived;
```

### Event handler signature

```csharp
void EventHandler(Message message)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | Message | Yes |  | The received message. |

#### Output

This method doesn't return anything. To receive a message, you must handle the `OnMessageReceived` event.

### Sample code

Start receiving messages on the `support` channel.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using Channel = PubnubChatApi.Channel;
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;
}
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}");
}

channel.Connect();
```

## Unwatch a channel

`Disconnect()` lets users unwatch a given channel and its messages.

### Method signature

```csharp
channel.Disconnect()
```

#### Output

This method doesn't return anything.

### Sample code

Stop receiving messages from a channel after receiving the first message.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using Channel = PubnubChatApi.Channel;
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;
}
void OnMessageReceivedHandler(Message message)
{
    Debug.Log($"Message received: {message.MessageText}");
    channel.Disconnect();
    Debug.Log("Disconnected from the channel.");
}
```

## Manage all subscriptions

Use these methods on the `Chat` object to reconnect or disconnect all active channel subscriptions at once, and to monitor overall subscription status.

### Reconnect all subscriptions

`ReconnectSubscriptions()` restores all active channel subscriptions after a disconnect.

#### Method signature

```csharp
chat.ReconnectSubscriptions()
```

#### Output

An awaitable `Task`.

### Disconnect all subscriptions

`DisconnectSubscriptions()` drops all active channel subscriptions at once.

#### Method signature

```csharp
chat.DisconnectSubscriptions()
```

#### Output

An awaitable `Task`.

### Stream subscription status

`StreamSubscriptionStatus()` enables or disables the `OnSubscriptionStatusChanged` event, which fires whenever the overall PubNub subscription state changes (for example, connected, reconnected, or access denied).

#### Method signature

```csharp
chat.StreamSubscriptionStatus(bool stream)
```

#### Event signature

```csharp
// event on the Chat object — enabled by StreamSubscriptionStatus()
public event Action<PNStatus> OnSubscriptionStatusChanged;
// needs a corresponding event handler
void EventHandler(PNStatus status)
```

#### Input

| Parameter | Required in `StreamSubscriptionStatus()` | Required in `OnSubscriptionStatusChanged` | Description |
| --- | --- | --- | --- |
| `stream`Type: `bool`Default: n/a | Yes | n/a | Whether to start (`true`) or stop (`false`) receiving subscription status events. |
| `status`Type: `PNStatus`Default: n/a | No | Yes | The PubNub status object containing the event category (for example, `PNConnectedCategory`, `PNReconnectedCategory`) and a list of affected channels. |

#### Output

This method doesn't return a value. Status changes are delivered through the `OnSubscriptionStatusChanged` event handler.

#### Sample code

```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;
}
chat.StreamSubscriptionStatus(true);
chat.OnSubscriptionStatusChanged += status =>
{
    Debug.Log($"Staus categoru: {status.Category}, affected channels: {status.AffectedChannels}");
};
//Will reconnect all existing subscriptions
await chat.ReconnectSubscriptions();

//Will disconnect all existing subscriptions
await chat.DisconnectSubscriptions();
```