orpc-client-event-iterator
Use event iterators in oRPC clients.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use event iterators in oRPC clients.
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 Client Event Iterator |
| description | Use event iterators in oRPC clients. |
| license | MIT |
| metadata | {"author":"Ali Torki","homepage":"https://github.com/ali-master","version":"1.0.0"} |
An Event Iterator in oRPC behaves like an AsyncGenerator.
const iterator = await client.streaming()
for await (const event of iterator) {
console.log(event.message)
}
const controller = new AbortController()
const iterator = await client.streaming(undefined, { signal: controller.signal })
setTimeout(async () => {
controller.abort()
// or
await iterator.return()
}, 1000)
for await (const event of iterator) {
console.log(event.message)
}
Unlike traditional SSE, the Event Iterator does not auto-retry. Use the Client Retry Plugin.
const iterator = await client.streaming()
try {
for await (const event of iterator) {
console.log(event.message)
}
} catch (error) {
if (error instanceof ORPCError) {
// Handle the error
}
}
consumeEventIteratorimport { consumeEventIterator } from '@orpc/client'
const cancel = consumeEventIterator(client.streaming(), {
onEvent: (event) => console.log(event.message),
onError: (error) => console.error(error),
onSuccess: (value) => console.log(value),
onFinish: (state) => console.log(state),
})
setTimeout(async () => {
await cancel()
}, 1000)
This utility accepts both promises and event iterators. Passing a promise lets it infer the correct error type.