---
id: "M:cAlgo.API.WebSocketClient.Send(System.String)"
kind: "method"
type: "T:cAlgo.API.WebSocketClient"
url: "https://help.ctrader.com/ctrader-algo/references/WebSocket/WebSocketClient/Send/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# WebSocketClient.Send

Member of [WebSocketClient](https://help.ctrader.com/ctrader-algo/references/WebSocket/WebSocketClient/index.md).

## Send(string text)

Sends passed text.

Environments: Desktop supported · CLI supported · Cloud not supported.

- Cloud: Connect, Send and Close do nothing: "WebSocket is not supported in cloud environment." is written to the log, State stays None and no events are raised.

C#:

```csharp
public void Send(string text)
```

Python:

```python
webSocketClient.Send(text: str) -> None
```

### Parameters

- `text` (`string`, Python `str`): Text to send.

### Examples

C#:

```csharp
var client = new WebSocketClient();
client.Connected += args => args.Client.Send("subscribe " + SymbolName);
client.Connect(new Uri("wss://stream.example.com/quotes"));
```

Python:

```python
from System import Uri

client = WebSocketClient()
client.Connected += lambda args: args.Client.Send(f"subscribe {api.SymbolName}")
client.Connect(Uri("wss://stream.example.com/quotes"))
```

## Send(byte[] data)

Sends passed binary data.

Environments: Desktop supported · CLI supported · Cloud not supported.

- Cloud: Connect, Send and Close do nothing: "WebSocket is not supported in cloud environment." is written to the log, State stays None and no events are raised.

C#:

```csharp
public void Send(byte[] data)
```

Python:

```python
webSocketClient.Send(data: list[int]) -> None
```

### Parameters

- `data` (`byte[]`, Python `list[int]`): Data to send.

### Examples

C#:

```csharp
var client = new WebSocketClient();
client.Connected += args => args.Client.Send(Encoding.UTF8.GetBytes("ping"));
client.Connect(new Uri("wss://stream.example.com/quotes"));
```

Python:

```python
from System import Uri
from System.Text import Encoding

client = WebSocketClient()
client.Connected += lambda args: args.Client.Send(Encoding.UTF8.GetBytes("ping"))
client.Connect(Uri("wss://stream.example.com/quotes"))
```

