> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hotstuff.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> WebSocket connection setup, limits, and error handling.

## Endpoints

| Environment | URL |
| - | - |
| Mainnet | `wss://api.hotstuff.trade/ws` |
| Testnet | `wss://testnet-api.hotstuff.trade/ws` |

## Limits

| Limit | Value |
| - | :-: |
| Connections per IP | 100 |
| Subscriptions per IP | 1,000 |
| Inbound messages per minute | 2,000 |
| Max message size | 512 bytes |

## Message Buffering

Each client has a **256-message outbound buffer**. When the buffer fills (slow consumer), new messages are **dropped silently**—the connection remains open with no error sent.

> [!WARNING]
>
> Slow clients will miss data without warning. Process messages promptly to avoid gaps.

## Rate Limiting

Exceeding 2,000 inbound messages/min triggers a JSON-RPC error. The connection stays open:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "error": {
    "code": -32001,
    "message": "Message rate limit exceeded",
    "data": {
      "retry_after": 12
    }
  }
}
```

The `retry_after` field indicates seconds to wait before sending more messages.

## JSON-RPC `post` Methods (Info + Exchange)

In addition to subscriptions, WebSocket supports request-response calls through:

* `method: "post"`
* `params.type: "info"` for all Info REST endpoints
* `params.type: "action"` for all Exchange REST endpoints

The payload format mirrors the REST API reference methods and params. See the WSS section **Info + Exchnage Requests** for separate interactive pages:

* `Info Requests`
* `Action Requests`

## Error Codes

| Code | Name | Description |
| :-: | - | - |
| -32700 | Parse Error | Invalid JSON |
| -32600 | Invalid Request | Malformed JSON-RPC 2.0 |
| -32601 | Method Not Found | Unknown method |
| -32602 | Invalid Params | Bad method parameters |
| -32603 | Internal Error | Server-side failure |
| -32000 | Server Error | Generic server error |
| -32001 | Too Many Requests | Rate limit exceeded |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.