# SendMessage Method

## Overloads

| [SendMessage(String, Action<Exception>)](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/NetSDKAPIref/Content/Qlik.Sense.JsonRpc.IWebSocketSessionContainer.SendMessage.htm#Qlik_Sense_JsonRpc_IWebSocketSessionContainer_SendMessage_System_String_System_Action_System_Exception__) |  | Send a message to a Qlik Sense instance. |
| --- | --- | --- |

[](https://help.qlik.com/en-US/sense-developer/Subsystems/NetSDKAPIref/Content/Qlik.Sense.JsonRpc.IWebSocketSessionContainer.SendMessage.htm) [](https://help.qlik.com/en-US/sense-developer/Subsystems/NetSDKAPIref/Content/Qlik.Sense.JsonRpc.IWebSocketSessionContainer.SendMessage.htm)

## SendMessage(String, Action&lt;Exception&gt;)

Send a message to a Qlik Sense instance.

### Declaration

```

          void SendMessage(string message, Action<Exception> onError = null)
    
  
```

### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.String | message | The message to send. |
| System.Action&lt;System.Exception&gt; | onError | Callback when an error occurs during the send operation. Note that this callback<br>is activated only if the send operation it self triggers an error. Errors returned by Qlik Sense as part<br>of a response to a message should be captured by the onMessage callback provided as argument to [OpenAsync(Action<String>, Action<Exception>, CancellationToken)](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/NetSDKAPIref/Content/Qlik.Sense.JsonRpc.IWebSocketSessionContainer.OpenAsync.htm#Qlik_Sense_JsonRpc_IWebSocketSessionContainer_OpenAsync_System_Action_System_String__System_Action_System_Exception__System_Threading_CancellationToken_). |

### Exceptions

| Type | Condition |
| --- | --- |
| [CommunicationErrorException](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/NetSDKAPIref/Content/Qlik.Sense.JsonRpc.CommunicationErrorException.htm) | Thrown if connection is not open. |