---
source_url: https://www.pubnub.com/docs/sdks/ruby/reconnection-policies
title: Reconnection Policies for Ruby SDK
updated_at: 2026-06-19T11:38:41.892Z
sdk_name: PubNub Ruby SDK
sdk_version: 6.1.0
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Reconnection Policies for Ruby SDK

PubNub Ruby SDK, use the latest version: 6.1.0

Install:

```bash
gem install pubnub@6.1.0
```

In networked applications, maintaining a stable connection is critical. The PubNub Ruby Software Development Kit (SDK) controls reconnection with two parameters to help applications recover from temporary network disruptions.

:::note Default behavior
Default behavior: If you do not set custom values, `:reconnect_interval` and `:reconnect_attempts` default to `10`.
:::

### Types of reconnection policies

Pubnub Ruby SDK uses two parameters in reconnection logic: `:reconnect_interval` (in seconds) and `:reconnect_attempts`. They are set when initializing a `Pubnub::Client` instance. By default, their values are `10` and `10`.

When the connection is lost, the server logs the warning "Connection lost! Reason: reasons," announces status to subscribers with type `Pubnub::Constants::TIMEOUT_ANNOUNCEMENT` (`:disconnect`), waits `:reconnect_interval`, and tries to reconnect. When reconnected, the client announces to subscribers status type `Pubnub::Constants::RECONNECTED_ANNOUNCEMENT` (`:reconnected`).

* **Use when**: Increase `:reconnect_attempts` for transient outages; decrease `:reconnect_interval` for faster retries in reliable networks.