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

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

# WebSocketClientOptions.KeepAliveInterval

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

## KeepAliveInterval

Gets or sets the WebSocket protocol keep-alive interval. Default value is set to 30 seconds.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TimeSpan KeepAliveInterval {get; set;}
```

Python:

```python
webSocketClientOptions.KeepAliveInterval: TimeSpan
```

### Returns

`TimeSpan` — 

### Examples

C#:

```csharp
var options = new WebSocketClientOptions { KeepAliveInterval = TimeSpan.FromSeconds(5) };
var client = new WebSocketClient(options);
client.Connect(new Uri("wss://stream.example.com/quotes"));
```

Python:

```python
from System import Uri, TimeSpan

options = WebSocketClientOptions()
options.KeepAliveInterval = TimeSpan.FromSeconds(5)
client = WebSocketClient(options)
client.Connect(Uri("wss://stream.example.com/quotes"))
```

