orpc-batch-requests-plugin
A plugin for oRPC to batch requests and responses to reduce overhead.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
A plugin for oRPC to batch requests and responses to reduce overhead.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Quick reference for Better Notify configuration, patterns, and common gotchas
Interactive setup wizard for adding Better Notify to a TypeScript/JavaScript project
Context and API guidance for Better Notify — end-to-end typed notification infrastructure for Node.js
Seamlessly use AI SDK inside your oRPC projects without any extra overhead.
Use oRPC inside an Astro project.
Functions to encode and decode base64url strings (URL-safe variant of base64).
| name | oRPC Batch Requests Plugin |
| description | A plugin for oRPC to batch requests and responses to reduce overhead. |
| license | MIT |
| metadata | {"author":"Ali Torki","homepage":"https://github.com/ali-master","version":"1.0.0"} |
The Batch Requests Plugin combines multiple requests and responses into a single batch, reducing overhead.
HTTP/2, HTTP/3, and later versions support multiplexing natively, so this plugin may be less beneficial in modern setups.
import { BatchHandlerPlugin } from '@orpc/server/plugins'
const handler = new RPCHandler(router, {
plugins: [new BatchHandlerPlugin()],
})
Requests within the same group will be considered for batching together.
import { BatchLinkPlugin } from '@orpc/client/plugins'
const link = new RPCLink({
url: 'https://api.example.com/rpc',
plugins: [
new BatchLinkPlugin({
groups: [
{ condition: () => true, context: {} }
]
}),
],
})
Default streaming mode sends responses asynchronously. Switch to buffered mode for environments without streaming support:
new BatchLinkPlugin({
mode: typeof window === 'undefined' ? 'buffered' : 'streaming',
groups: [{ condition: () => true, context: {} }]
})
Does not support AsyncIteratorObject or File/Blob in responses. Use exclude to skip unsupported procedures:
new BatchLinkPlugin({
groups: [{ condition: () => true, context: {} }],
exclude: ({ path }) => ['planets/getImage', 'planets/subscribe'].includes(path.join('/'))
})
new BatchLinkPlugin({
groups: [{ condition: () => true, context: {} }],
headers: () => ({ authorization: 'Bearer 1234567890' })
})
const link = new RPCLink<ClientContext>({
url: 'http://localhost:3000/rpc',
method: ({ context }) => context?.cache ? 'GET' : 'POST',
plugins: [
new BatchLinkPlugin({
groups: [
{
condition: ({ context }) => context?.cache === 'force-cache',
context: { cache: 'force-cache' },
},
{ condition: () => true, context: {} },
],
}),
],
fetch: (request, init, { context }) => globalThis.fetch(request, {
...init,
cache: context?.cache,
}),
})