> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# sse.onDisconnect()

> Public low-code contract, signatures and examples for sse.onDisconnect.

## `sse.onDisconnect()`

Register one callback for continue-and-notify disconnect policy. Invoked at most once in the same isolate.
Shares the original execution deadline; no extra time is granted. continue skips it and cancel disposes the isolate.
Registration after disconnect still notifies once while execution remains alive. Callback failures appear in diagnostics.
CPU-bound code, a hard timeout or process failure can prevent notification; this is not a durable cleanup guarantee.

### Signature

```ts theme={null}
static onDisconnect(callback: () => void | Promise<void>): void;
```

### Example

```ts theme={null}
sse.onDisconnect(async () => { await api.setInstanceCache('connection-state', { disconnected: true }, 300); });
```

See [all sse methods](https://docs.revoengine.com/low-code/reference/sse.md) or [runtime basics](https://docs.revoengine.com/low-code/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.