# Limits

This page lists every limit the gateway applies to a desk, and the SDK's own timeouts. Stay inside them and you never see a `4429`.

## Summary

| Limit | Value | Applies to | Past it |
| --- | --- | --- | --- |
| Sockets per maker | 16 | All your `/maker` and feed sockets, across every token of your quote key | Close `4429` `Too many connections` |
| Frame budget | 100 frames at once, then 20 per second | Each socket: messages and pings you send | Close `4429` `Too many frames` |
| Frame size | 16 384 bytes | Each frame you send | Close `1009` |
| Unread data | 1 MiB | Data queued for you at a heartbeat | Socket terminated, no close frame |
| Heartbeat | 1 ping every 30 s | Each socket | Socket terminated if the previous ping was not echoed |
| JSON-RPC `id` | 128 characters | Each request | Error `invalid JSON-RPC request` |
| Bids per RFQ | 1 per maker | Each RFQ | Error `Maker already bid in this auction` |
| RFQ memory | 120 to 130 s after creation | `GET /api/rfqs/<id>` and every method | `404` or an unknown-RFQ error |


## Connections

### Sockets per maker

Your quote key may hold 16 open sockets on the gateway at once. `/maker` sockets and feed sockets count alike. All tokens covr issued for the same quote key share the 16. The 17th upgrade completes only to be closed with `4429` `Too many connections`. Other desks are not affected.

A socket's slot frees when it closes. A dead socket that never closed keeps its slot until the heartbeat reaps it, within about 60 s.


### Shared capacity

The endpoint also holds a fixed total number of desk connections, shared by every desk, and a fixed number of refusals in progress. When either is full, a new upgrade is dropped, or answered with HTTP `503`, before any WebSocket handshake. Back off and retry.

At most 32 refusals (`4401`, `4403`, `4429` `Too many connections`) are in progress at once across all callers. Each lasts about 1 s at most. A caller past that is dropped without a close code.


## Frame budget

Each socket has a token bucket:

- It holds at most 100 frames and starts full.
- It refills at 20 frames per second.
- Every message you send costs 1. Every WebSocket ping you send costs 1.
- Pongs cost nothing, so answering the gateway's heartbeat is free.

When a frame arrives with less than 1 left, the gateway closes the socket with `4429` `Too many frames` and reads nothing more from it. Frames already read are still answered.


A normal desk uses a tiny fraction of this: about 2 frames per RFQ it bids on, plus 1 ping every 15 s from `GatewayClient`. Never retry a refused request in a tight loop.

## Frame size

The gateway reads frames of up to 16 384 bytes. A larger frame closes the socket with `1009` (message too big). The largest legitimate desk frame, a `quote`, is under 1 KB (931 bytes for the golden vector).

`GatewayClient` refuses to send a frame over `GATEWAY_MAX_FRAME_BYTES` (16 384) and rejects the request locally. It also refuses frames over that size from the gateway.


## Unread data and heartbeat

Every 30 s the gateway terminates a socket that has more than 1 MiB of data queued for it, or that did not echo the previous ping. Read your sockets continuously, including feeds you are not using right now. See [Heartbeat](https://docs.covr.markets/reference/gateway/connection.md#heartbeat).


## Quote admission capacity

The gateway runs at most 4 quote admissions at a time, across all makers, and lets at most 8 more wait for a slot. A waiting quote starts only while the hard deadline has not passed. A quote that arrives while 4 are running and 8 are waiting, or that is still waiting or running at the hard deadline, is refused with `Ordinary V3 quote admission unavailable`, and the award passes.


## HTTP

| Limit | Value |
| --- | --- |
| Request headers must arrive within | 10 s |
| Whole request must finish within | 15 s |
| Through covr's public endpoint, the gateway must answer within | 5 s, else `502` `Gateway unavailable` |

`GET /api/rfqs/<id>` costs nothing against your frame budget. Call it once per RFQ, not in a polling loop: one read gives you everything you need to bid.


## SDK timeouts

`GatewayClient` adds its own bounds. All are `GatewayClientOptions` in milliseconds or counts:

| Option | Default | Range | What it bounds |
| --- | --- | --- | --- |
| `requestTimeoutMs` | 5 000 | 1 to 60 000 | Wait for a reply on `/maker`. On timeout the request rejects with `OutcomeUnknownError`, and the client sends nothing more for that RFQ. |
| `httpTimeoutMs` | 5 000 | 1 to 60 000 | `getRfq`. |
| `handshakeTimeoutMs` | 10 000 | 1 to 60 000 | Each socket upgrade. |
| `heartbeatIntervalMs` | 15 000 | 1 to 300 000 | Time between the client's pings. |
| `heartbeatTimeoutMs` | 30 000 | 1 to 300 000 | Time to wait for a pong before ending the socket. |
| `maxQueuedEvents` | 1 000 | 1 to 1 000 000 | Unread events. One more closes the client with code `1008`. |


The request timeout (5 s) is longer than the whole award window (3 s), so a timeout never tells you that you missed `awardUntil`. Check `awardUntil` yourself before you sign. If a `quote` reply never arrives, its outcome is unknown: treat the quote as live.

---

Source: https://docs.covr.markets/reference/gateway/limits · Part of covr Docs, https://docs.covr.markets/llms.txt
