Skip to main content
CosmJS exposes timeouts at three levels: HTTP requests, WebSocket connections, and transaction broadcast polling. Each is configured independently.

HTTP Request Timeout

Pass a timeout in milliseconds as the second argument to HttpClient:
When the timeout fires, the underlying fetch call is aborted via AbortSignal.timeout(). If omitted, requests have no timeout and rely on the runtime’s default behavior. For HttpBatchClient, use the httpTimeout option:

WebSocket Connection Timeout

The underlying socket has a 10-second connection timeout. If the WebSocket handshake doesn’t complete in time, the connection promise rejects with a timeout error.

Broadcast Timeout

Separately from transport timeouts, signing clients control how long signAndBroadcast() polls for transaction inclusion in a block:
These are not transport-level timeouts — they only affect signAndBroadcast(). If you use signAndBroadcastSync instead, no polling occurs and these options are ignored.

Next Steps

Connection Errors

Handle timeout errors and other connection failures.

Custom Endpoints

Combine timeouts with custom headers and batching.