# Network Disruptions

Connection problems can occur during a call, for example when switching networks
or if the signal is poor. In this case the SDK will try to reconnect
automatically.

The `call.setDisconnectionTimeout` method allows you to specify how long a user
can remain disconnected before being removed from the call. This is particularly
useful when users experience short network interruptions and are able to
reconnect quickly. By setting a timeout you ensure that users are only dropped
if their disconnection lasts longer than the specified time.

## Setting the disconnection timeout

Once the call has been created, you can set a disconnection timeout that defines
how long a user can stay disconnected before being dropped. Here’s how to do it:

```ts
call.setDisconnectionTimeout(30); // Try to reconnect for 30 seconds
call.setDisconnectionTimeout(0); // try to reconnect indefinitely (default)
```

By default, the disconnection timeout is set to `0`, allowing the user to
remain in the call until their connection restores or the call is ended.

## Notify user after disconnection

The current reconnection state is reflected in the calling state.

After a specified timeout, if the connection is not reestablished, the calling
state becomes `CallingState.RECONNECTING_FAILED`. We can subscribe to it to
display a special UI, notifying the user after disconnection:

```tsx
const { useCallCallingState } = useCallStateHooks();
const callingState = useCallCallingState();

if (callingState === CallingState.RECONNECTING_FAILED) {
  return <ConnectionError />; // display connection error UI
}
```

---

For the most recent version of this documentation, visit [https://getstream.io/video/docs/react/v2/ui-cookbook/network-disruption/](https://getstream.io/video/docs/react/v2/ui-cookbook/network-disruption/).