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

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

# WebSocketClient.CloseStatus

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

## CloseStatus

Gets close status / reason.

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 WebSocketClientCloseStatus? CloseStatus {get;}
```

Python:

```python
webSocketClient.CloseStatus: WebSocketClientCloseStatus | None
```

### Returns

`WebSocketClientCloseStatus?` — 

### Examples

C#:

```csharp
var client = new WebSocketClient();
client.Disconnected += args =>
{
    if (args.Client.CloseStatus.HasValue)
        Print("Connection closed with status {0}", args.Client.CloseStatus.Value);
};
client.Connect(new Uri("wss://stream.example.com/quotes"));
```

Python:

```python
from System import Uri

client = WebSocketClient()
client.Disconnected += lambda args: api.Print(f"Connection closed with status {args.Client.CloseStatus}")
client.Connect(Uri("wss://stream.example.com/quotes"))
```

