Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions src/content/data-streams/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4555,19 +4555,37 @@ Security best practices:

### High Availability Mode

The Data Streams SDK supports High Availability mode for WebSocket connections. When enabled with `WebSocketHighAvailability::Enabled`, the SDK maintains concurrent connections to different instances to ensure high availability, fault tolerance, and minimize the risk of report gaps.

#### HA Mode Behavior

When high availability mode is enabled:

- The client queries the server for available origins using the `X-Cll-Available-Origins` header
- Multiple WebSocket connections are established to different server instances
- Reports are deduplicated when received across connections
- Partial reconnects occur when some connections fail while others remain active
- Full reconnects occur when all connections fail

#### HA Configuration

Pass a single WebSocket URL. When HA mode is enabled, the SDK discovers additional origin endpoints behind that URL and opens a connection to each origin.

```rust
use chainlink_data_streams_sdk::config::{Config, WebSocketHighAvailability};

let ws_urls = "wss://ws1.dataengine.chain.link,wss://ws2.dataengine.chain.link";
let config = Config::new(api_key, api_secret, rest_url, ws_urls)
let ws_url = "wss://ws.dataengine.chain.link";
let config = Config::new(api_key, api_secret, rest_url, ws_url)
// Enable WebSocket HA mode
.with_ws_ha(WebSocketHighAvailability::Enabled)
// Increase the max reconnection attempts (optional, default is 5)
.with_ws_max_reconnect(10)
.build()?;
```

- Multiple WebSocket endpoints
**Note:** High Availability mode is only available on mainnet endpoints, not testnet.

- Automatic origin discovery from a single WebSocket URL
- Automatic failover on connection loss
- Parallel connections to reduce gaps in data

Expand All @@ -4576,17 +4594,17 @@ let config = Config::new(api_key, api_secret, rest_url, ws_urls)
The SDK allows you to:

- Set `ws_max_reconnect`: The maximum number of reconnection attempts (default: 5)
- Enable HA for multiple WebSocket endpoints
- Enable HA for automatic multi-origin WebSocket connections
- Optional `insecure_skip_verify` for TLS

Example:

```rust
use chainlink_data_streams_sdk::config::{Config, InsecureSkipVerify, WebSocketHighAvailability};

let ws_urls = "wss://ws.testnet-dataengine.chain.link";
let ws_url = "wss://ws.testnet-dataengine.chain.link";

let config = Config::new(api_key, api_secret, rest_url, ws_urls)
let config = Config::new(api_key, api_secret, rest_url, ws_url)
.with_ws_ha(WebSocketHighAvailability::Enabled)
.with_ws_max_reconnect(5)
.with_insecure_skip_verify(InsecureSkipVerify::Enabled)
Expand Down Expand Up @@ -4638,7 +4656,7 @@ The [SDK repository](https://github.com/smartcontractkit/data-streams-sdk/blob/m
- Fetching a single report, bulk reports, or paginated reports
- Compressing report data
- Simple WebSocket streaming
- Multiple WebSocket endpoints (HA)
- WebSocket streaming with HA mode

## Performance Considerations

Expand Down Expand Up @@ -4674,14 +4692,14 @@ pub struct ConfigBuilder {

- Purpose: Enables or disables HA mode for WebSocket streaming.
- Values:
- `WebSocketHighAvailability::Enabled`: Maintains multiple WebSocket connections to different endpoints simultaneously.
- `WebSocketHighAvailability::Enabled`: Discovers available origins from the configured WebSocket URL and maintains multiple connections simultaneously.
- `WebSocketHighAvailability::Disabled`: Maintains a single connection.
- Default: `Disabled`.
- Example Use Case:

```rust
// When you want uninterrupted streaming even if one server goes down:
let config = Config::new(api_key, api_secret, rest_url, "wss://ws1,...,wss://wsN")
// When you want uninterrupted streaming even if one origin goes down:
let config = Config::new(api_key, api_secret, rest_url, "wss://ws.dataengine.chain.link")
.with_ws_ha(WebSocketHighAvailability::Enabled)
.build()?;
```
Expand Down Expand Up @@ -8953,7 +8971,7 @@ let config = Config::new(
api_key,
api_secret,
"https://api.dataengine.chain.link".to_string(), // Mainnet endpoint
"wss://ws.dataengine.chain.link,wss://ws.dataengine.chain.link".to_string(), // Multiple WebSocket endpoints
"wss://ws.dataengine.chain.link".to_string(), // Mainnet WebSocket endpoint
)
.with_ws_ha(WebSocketHighAvailability::Enabled) // Enable WebSocket High Availability Mode
.build()?;
Expand All @@ -8962,6 +8980,8 @@ let config = Config::new(
// ... existing code ...
```

When `WebSocketHighAvailability::Enabled` is set, the SDK automatically discovers multiple origin endpoints behind the single URL and establishes separate connections to each origin.

See more details about HA mode in the [SDK Reference](/data-streams/reference/data-streams-api/rust-sdk#high-availability-mode).

### Decoded report details
Expand Down
38 changes: 28 additions & 10 deletions src/content/data-streams/reference/data-streams-api/rust-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,37 @@ Security best practices:

### High Availability Mode

The Data Streams SDK supports High Availability mode for WebSocket connections. When enabled with `WebSocketHighAvailability::Enabled`, the SDK maintains concurrent connections to different instances to ensure high availability, fault tolerance, and minimize the risk of report gaps.

#### HA Mode Behavior

When high availability mode is enabled:

- The client queries the server for available origins using the `X-Cll-Available-Origins` header
- Multiple WebSocket connections are established to different server instances
- Reports are deduplicated when received across connections
- Partial reconnects occur when some connections fail while others remain active
- Full reconnects occur when all connections fail

#### HA Configuration

Pass a single WebSocket URL. When HA mode is enabled, the SDK discovers additional origin endpoints behind that URL and opens a connection to each origin.

```rust
use chainlink_data_streams_sdk::config::{Config, WebSocketHighAvailability};

let ws_urls = "wss://ws1.dataengine.chain.link,wss://ws2.dataengine.chain.link";
let config = Config::new(api_key, api_secret, rest_url, ws_urls)
let ws_url = "wss://ws.dataengine.chain.link";
let config = Config::new(api_key, api_secret, rest_url, ws_url)
// Enable WebSocket HA mode
.with_ws_ha(WebSocketHighAvailability::Enabled)
// Increase the max reconnection attempts (optional, default is 5)
.with_ws_max_reconnect(10)
.build()?;
```

- Multiple WebSocket endpoints
**Note:** High Availability mode is only available on mainnet endpoints, not testnet.

- Automatic origin discovery from a single WebSocket URL
- Automatic failover on connection loss
- Parallel connections to reduce gaps in data

Expand All @@ -170,17 +188,17 @@ let config = Config::new(api_key, api_secret, rest_url, ws_urls)
The SDK allows you to:

- Set `ws_max_reconnect`: The maximum number of reconnection attempts (default: 5)
- Enable HA for multiple WebSocket endpoints
- Enable HA for automatic multi-origin WebSocket connections
- Optional `insecure_skip_verify` for TLS

Example:

```rust
use chainlink_data_streams_sdk::config::{Config, InsecureSkipVerify, WebSocketHighAvailability};

let ws_urls = "wss://ws.testnet-dataengine.chain.link";
let ws_url = "wss://ws.testnet-dataengine.chain.link";

let config = Config::new(api_key, api_secret, rest_url, ws_urls)
let config = Config::new(api_key, api_secret, rest_url, ws_url)
.with_ws_ha(WebSocketHighAvailability::Enabled)
.with_ws_max_reconnect(5)
.with_insecure_skip_verify(InsecureSkipVerify::Enabled)
Expand Down Expand Up @@ -232,7 +250,7 @@ The [SDK repository](https://github.com/smartcontractkit/data-streams-sdk/blob/m
- Fetching a single report, bulk reports, or paginated reports
- Compressing report data
- Simple WebSocket streaming
- Multiple WebSocket endpoints (HA)
- WebSocket streaming with HA mode

## Performance Considerations

Expand Down Expand Up @@ -268,14 +286,14 @@ pub struct ConfigBuilder {

- Purpose: Enables or disables HA mode for WebSocket streaming.
- Values:
- `WebSocketHighAvailability::Enabled`: Maintains multiple WebSocket connections to different endpoints simultaneously.
- `WebSocketHighAvailability::Enabled`: Discovers available origins from the configured WebSocket URL and maintains multiple connections simultaneously.
- `WebSocketHighAvailability::Disabled`: Maintains a single connection.
- Default: `Disabled`.
- Example Use Case:

```rust
// When you want uninterrupted streaming even if one server goes down:
let config = Config::new(api_key, api_secret, rest_url, "wss://ws1,...,wss://wsN")
// When you want uninterrupted streaming even if one origin goes down:
let config = Config::new(api_key, api_secret, rest_url, "wss://ws.dataengine.chain.link")
.with_ws_ha(WebSocketHighAvailability::Enabled)
.build()?;
```
Expand Down
4 changes: 3 additions & 1 deletion src/content/data-streams/tutorials/rust-sdk-stream.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ let config = Config::new(
api_key,
api_secret,
"https://api.dataengine.chain.link".to_string(), // Mainnet endpoint
"wss://ws.dataengine.chain.link,wss://ws.dataengine.chain.link".to_string(), // Multiple WebSocket endpoints
"wss://ws.dataengine.chain.link".to_string(), // Mainnet WebSocket endpoint
)
.with_ws_ha(WebSocketHighAvailability::Enabled) // Enable WebSocket High Availability Mode
.build()?;
Expand All @@ -357,6 +357,8 @@ let config = Config::new(
// ... existing code ...
```

When `WebSocketHighAvailability::Enabled` is set, the SDK automatically discovers multiple origin endpoints behind the single URL and establishes separate connections to each origin.

See more details about HA mode in the [SDK Reference](/data-streams/reference/data-streams-api/rust-sdk#high-availability-mode).

### Decoded report details
Expand Down
30 changes: 15 additions & 15 deletions src/content/datalink/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2359,22 +2359,22 @@ In this example, we're using report schema `v4` for the EUR/USD feed, but your i
[...]
```

The example above demonstrates streaming data from a single crypto stream. For production environments, especially when subscribing to multiple streams, it's recommended to enable [High Availability (HA) mode](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/docs/examples/wss_multiple.md). This can be achieved by:

1. Adding multiple WebSocket endpoints in the configuration:

```rust
"wss://ws.testnet-dataengine.chain.link,wss://ws.testnet-dataengine.chain.link"
```

2. Enabling HA mode in the configuration:
```rust
use chainlink_data_streams_sdk::config::WebSocketHighAvailability;
// ...
.with_ws_ha(WebSocketHighAvailability::Enabled)
```
The example above demonstrates streaming data from a single crypto stream. For production environments, especially when subscribing to multiple streams, it's recommended to enable [High Availability (HA) mode](/data-streams/reference/data-streams-api/rust-sdk#high-availability-mode). Use a mainnet WebSocket URL and enable HA mode in the configuration:

```rust
use chainlink_data_streams_sdk::config::WebSocketHighAvailability;

let config = Config::new(
api_key,
api_secret,
"https://api.dataengine.chain.link",
"wss://ws.dataengine.chain.link",
)
.with_ws_ha(WebSocketHighAvailability::Enabled)
.build()?;
```

When HA mode is enabled and multiple WebSocket origins are provided, the Stream will maintain concurrent connections to different instances. This ensures high availability, fault tolerance, and minimizes the risk of report gaps.
When HA mode is enabled, the SDK discovers available origins from the configured WebSocket URL and maintains concurrent connections to different instances. This ensures high availability, fault tolerance, and minimizes the risk of report gaps.

#### Decoded report details

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,22 @@ In this example, we're using report schema `v4` for the EUR/USD feed, but your i
[...]
```

The example above demonstrates streaming data from a single crypto stream. For production environments, especially when subscribing to multiple streams, it's recommended to enable [High Availability (HA) mode](https://github.com/smartcontractkit/data-streams-sdk/blob/main/rust/docs/examples/wss_multiple.md). This can be achieved by:

1. Adding multiple WebSocket endpoints in the configuration:

```rust
"wss://ws.testnet-dataengine.chain.link,wss://ws.testnet-dataengine.chain.link"
```

1. Enabling HA mode in the configuration:
```rust
use chainlink_data_streams_sdk::config::WebSocketHighAvailability;
// ...
.with_ws_ha(WebSocketHighAvailability::Enabled)
```

When HA mode is enabled and multiple WebSocket origins are provided, the Stream will maintain concurrent connections to different instances. This ensures high availability, fault tolerance, and minimizes the risk of report gaps.
The example above demonstrates streaming data from a single crypto stream. For production environments, especially when subscribing to multiple streams, it's recommended to enable [High Availability (HA) mode](/data-streams/reference/data-streams-api/rust-sdk#high-availability-mode). Use a mainnet WebSocket URL and enable HA mode in the configuration:

```rust
use chainlink_data_streams_sdk::config::WebSocketHighAvailability;

let config = Config::new(
api_key,
api_secret,
"https://api.dataengine.chain.link",
"wss://ws.dataengine.chain.link",
)
.with_ws_ha(WebSocketHighAvailability::Enabled)
.build()?;
```

When HA mode is enabled, the SDK discovers available origins from the configured WebSocket URL and maintains concurrent connections to different instances. This ensures high availability, fault tolerance, and minimizes the risk of report gaps.

#### Decoded report details

Expand Down
Loading