# Server-side usage

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

Go is **synchronous**. Pass `context.Context` on every call. Cancel the context to stop waits and stream receives.

## Process lifecycle

- Create **one client** per process (or per logical bot) and reuse it.
- Close / drop the client on shutdown so HTTP and WebSocket pools release cleanly (Python context managers, Go `Close()`, Rust drop).
- Cancel work with async cancellation (Python task cancel), `context.Context` (Go), or Tokio cancellation (Rust).

## Configuration

Prefer explicit credentials from your secret store. Use `from_env` / `FromEnv` 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 **ProtoJSON body bytes** (matching `connect.WithProtoJSON()`), not binary protobuf. A body/signature mismatch fails auth.

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