# Server-side usage

Long-running bots, process lifecycle, catalogs, and configuration tips.

Use Tokio for long-running Rust services. The SDK's async model is introduced once in [Overview](https://testnet.polyester.com/docs/sdk/rust/get-started/overview).

## Process lifecycle

- Create **one client** per process (or per logical bot) and reuse it.
- Drop the client on shutdown so HTTP and WebSocket resources release cleanly.
- Cancel surrounding work by aborting or cancelling the owning Tokio task.

## Configuration

Prefer explicit credentials from your secret store. Use `Client::from_env` only for local scripts.

Wait for catalogs before decimal writes. Disable catalog hydration only if you exclusively use pre-scaled integers and understand the tradeoff.

## Wire format

Binary Protobuf is the default Connect codec. JSON wire formats are for debugging, not hot paths. With `WireFormat::Json`, API-key signatures hash the **JSON body bytes that are actually sent**, not protobuf. A body/signature mismatch fails auth.

See [Client configuration](https://testnet.polyester.com/docs/sdk/rust/reference/client-configuration).
