# ExposedApi.Internal.MessageHandler

[Embedding API Reference](..) / [Modules](../modules) / [exposed-api](../modules/exposed_api) / [\<internal>](../modules/exposed_api._internal_) / MessageHandler

## Class: MessageHandler

[exposed-api](../modules/exposed_api).[\<internal>](../modules/exposed_api._internal_).MessageHandler

### Table of contents

#### Constructors

* [constructor](#constructor)

#### Methods

* [sendMessage](#sendmessage)
* [setMessageExecution](#setmessageexecution)
* [setOutgoingMessageBus](#setoutgoingmessagebus)

### Constructors

#### constructor

• **new MessageHandler**(`side`, `incomingMessageBus`, `outgoingMessageBus`, `messageExecution`): [`MessageHandler`](exposed_api._internal_.messagehandler)

**Parameters**

| Name                 | Type                                                                                                                                         |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `side`               | [`CommunicationSide`](../../modules/exposed_api._internal_#communicationside)                                                                |
| `incomingMessageBus` | [`Nullable`](../../modules/exposed_api._internal_#nullable)<[`IncomingMessageBus`](../interfaces/exposed_api._internal_.incomingmessagebus)> |
| `outgoingMessageBus` | [`Nullable`](../../modules/exposed_api._internal_#nullable)<[`OutgoingMessageBus`](../interfaces/exposed_api._internal_.outgoingmessagebus)> |
| `messageExecution`   | [`Nullable`](../../modules/exposed_api._internal_#nullable)<[`MessageExecution`](../../modules/exposed_api._internal_#messageexecution)>     |

**Returns**

[`MessageHandler`](exposed_api._internal_.messagehandler)

### Methods

#### sendMessage

▸ **sendMessage**(`message`, `args?`): `Promise`<`any`>

**Parameters**

| Name      | Type     | Default value |
| --------- | -------- | ------------- |
| `message` | `string` | `undefined`   |
| `args`    | `any`\[] | `[]`          |

**Returns**

`Promise`<`any`>

***

#### setMessageExecution

▸ **setMessageExecution**(`fun`): `void`

**Parameters**

| Name  | Type                                                                        |
| ----- | --------------------------------------------------------------------------- |
| `fun` | [`MessageExecution`](../../modules/exposed_api._internal_#messageexecution) |

**Returns**

`void`

***

#### setOutgoingMessageBus

▸ **setOutgoingMessageBus**(`outgoingMessageBus`): `void`

**Parameters**

| Name                 | Type                                                                            |
| -------------------- | ------------------------------------------------------------------------------- |
| `outgoingMessageBus` | [`OutgoingMessageBus`](../interfaces/exposed_api._internal_.outgoingmessagebus) |

**Returns**

`void`
