Endpoints
By default, SDKs connect to the cloud instance at s2.dev, and only require an access token to get started, which can be generated from the dashboard. Users who elect to use Private Networking can provide the relevant endpoints as an override when configuring the client. SDKs can also connect to any S2-compatible endpoint, such as s2-lite for local development:- TypeScript
- Go
- Rust
Environment Variables
SDKs can read some common configuration keys from environment variables:| Variable | Description |
|---|---|
S2_ACCOUNT_ENDPOINT | Account-level API endpoint |
S2_BASIN_ENDPOINT | Basin-level API endpoint (may include {basin} placeholder for DNS-based routing) |
Timeouts
SDKs support configuring connection and request timeouts:- TypeScript
- Go
- Rust
- Connection timeout: Maximum time to wait for a TCP connection to be established. This is a “fail fast” timeout that aborts slow connections early.
- Request timeout: Maximum time to wait for a unary (non-streaming) request to complete. For append sessions, this value is also used to determine the SDK-enforced timeout for an individual batch append to be acknowledged.
Retry Behavior
SDKs automatically retry transient failures using exponential backoff with jitter.- TypeScript
- Go
- Rust
Append Retry Policy
Retrying appends requires care: if an append succeeds but the acknowledgement is lost, retrying would create duplicate records in a stream. TheappendRetryPolicy setting controls how to react in this situation, by treating append retries as a special case.
| Policy | Behavior |
|---|---|
all (default) | Retry all appends. Duplicates are possible on transient failures. |
noSideEffects | Only retry appends that include matchSeqNum, which makes them idempotent. |
noSideEffects means that, in the event of a failure, the caller will manually need to verify whether or not the append succeeded (e.g., by reading or otherwise inspecting the state of the stream).
Configuration Reference
Timeout Settings
| Setting | Default | Description |
|---|---|---|
| Connection timeout | 3 seconds | Max time to establish TCP connection |
| Request timeout | 5 seconds | Max time for request completion |
Retry Settings
| Setting | Default | Description |
|---|---|---|
| Max attempts | 3 | Maximum retry attempts |
| Min base delay | 100 ms | Minimum base delay for exponential backoff |
| Max base delay | 1 second | Maximum base delay (actual delay with jitter can be up to 2x) |
| Append retry policy | all | How to handle append retries when duplication is possible |

