---
id: "E:cAlgo.API.Internals.IServer.Disconnected"
kind: "event"
type: "T:cAlgo.API.Internals.IServer"
url: "https://help.ctrader.com/ctrader-algo/references/Application/IServer/Disconnected/"
---

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

# IServer.Disconnected

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

## Disconnected

Disconnected - Event raised when connection with the server is lost

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
event Action Disconnected;
```

Python:

```python
api.Server.Disconnected += handler  # handler()
```

### Returns

`Action` — 

### Examples

C#:

```csharp
protected override void OnStart()
{
    Server.Disconnected += OnServerDisconnected;
}

private void OnServerDisconnected()
{
    Print("Connection lost at {0}", Server.Time);
}
```

Python:

```python
def on_start(self):
    api.Server.Disconnected += self.on_server_disconnected

def on_server_disconnected(self):
    api.Print(f"Connection lost at {api.Server.Time}")
```

