# RegisterMessageHandler

> Registers a new handler on a specific channel. The new handler is called whenever a message is sent to the ChannelClient.

## Definition

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

## RegisterMessageHandler(Action\<string>)

Registers a new handler on a specific channel. The new handler is called whenever a message is sent to the [ChannelClient](/engine/6000.5/script-reference/unityeditor/mpe/channelclient.md).

```csharp
public Action RegisterMessageHandler(Action<string> handler)
```

### Parameters

**** (\[Action\<string>]\(https\://learn.microsoft.com/dotnet/api/system.action)): A handler for all incoming messages on a specific channel.

### Returns

| Type                                                           | Description                                                                                                                                                                                                    |
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Action](https://learn.microsoft.com/dotnet/api/system.action) | An action that, when invoked, unregisters the ChannelClient handler (See [ChannelClient.UnregisterMessageHandler](/engine/6000.5/script-reference/unityeditor/mpe/channelclient/unregistermessagehandler.md)). |

## RegisterMessageHandler(Action\<byte\[]>)

Registers a new handler on a specific channel. The new handler is called whenever a message is sent to the [ChannelClient](/engine/6000.5/script-reference/unityeditor/mpe/channelclient.md).

```csharp
public Action RegisterMessageHandler(Action<byte[]> handler)
```

### Parameters

**** (\[Action\<byte\[]>]\(https\://learn.microsoft.com/dotnet/api/system.action)): A handler for all incoming messages on a specific channel.

### Returns

| Type                                                           | Description                                                                                                                                                                                                    |
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Action](https://learn.microsoft.com/dotnet/api/system.action) | An action that, when invoked, unregisters the ChannelClient handler (See [ChannelClient.UnregisterMessageHandler](/engine/6000.5/script-reference/unityeditor/mpe/channelclient/unregistermessagehandler.md)). |
