BatchHandlerPlugin allows clients to send multiple oRPC calls in a single HTTP request. This reduces latency for operations that would otherwise require multiple round trips.
Usage
How it works
- The client sends a single HTTP request with the
x-orpc-batchheader set tobufferedorstreaming. - The server parses the batch, executes each sub-request concurrently, and returns all responses in a single HTTP response body.
- Sub-requests that use streaming (SSE) or file uploads are rejected within the batch — call those procedures separately.
Options
Maximum number of requests per batch. If exceeded, the server returns HTTP 413. Can be a static number or an async function for dynamic limits.
Transform each sub-request before processing. By default, batch-level headers are merged into each sub-request so auth headers propagate automatically.
HTTP status code for a successful batch response.
Additional headers to include in the batch response.
Limitations
Client-side batching
On the client, enable batching by configuring theRPCLink:
