orpc-client-event-iterator
Use event iterators in oRPC clients.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Use event iterators in oRPC clients.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional 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.