---
id: "P:cAlgo.API.WebSocketClient.State"
kind: "property"
type: "T:cAlgo.API.WebSocketClient"
url: "https://help.ctrader.com/ctrader-algo/references/WebSocket/WebSocketClient/State/"
---

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

# WebSocketClient.State

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

## State

Gets current state of WebSocketClient instance.

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 WebSocketClientState State {get;}
```

Python:

```python
webSocketClient.State: WebSocketClientState
```

### Returns

`WebSocketClientState` — 

### Examples

C#:

```csharp
var client = new WebSocketClient();
client.Connect(new Uri("wss://stream.example.com/quotes"));
Print("WebSocket state: {0}", client.State);
```

Python:

```python
from System import Uri

client = WebSocketClient()
client.Connect(Uri("wss://stream.example.com/quotes"))
api.Print(f"WebSocket state: {client.State}")
```

