# GetOrCreateChannel(string, Action<int, byte[]>)

> Gets or creates a new channel.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.MPE](/engine/6000.7/script-reference/unityeditor/mpe.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static Action GetOrCreateChannel(string channelName, Action<int, byte[]> handler)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the channel to retrieve.**** (\[Action\<int, byte\[]>]\(https\://learn.microsoft.com/dotnet/api/system.action)): The channel handler to register.

### Returns

| Type                                                           | Description                                                                                                                                                                                                        |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Action](https://learn.microsoft.com/dotnet/api/system.action) | This action can be invoked to unregister the handler from the channel (see [ChannelService.UnregisterMessageHandler](/engine/6000.7/script-reference/unityeditor/mpe/channelservice/unregistermessagehandler.md)). |

### Remarks

When you create a channel, the ChannelService listens to connections on it, and routes all messages sent to it. You have to register a handler to process the messages and send them back to other clients."

If a channel with the same name already exists, it appends the handler to its list of handlers. This allows you to log or listen to all messages sent to a specific channel.
