inngest/inngest-skills/inngest-realtime
Claude Code and agent skill by inngest/inngest-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when streaming durable workflow updates to a UI in real time — live order status pages that animate as steps complete, AI agent token streaming from a function to the browser, log tailing for long-running jobs, or human-in-the-loop approval flows that publish a prompt and wait for a user reply. Covers Inngest v4 native realtime: defining typed channels, publishing from inside step.run, minting subscription tokens via server actions, and consuming the stream from React/Next.js client components.
Install
npx vskill@latest install inngest/inngest-skills/inngest-realtimeSKILL.md
The same SKILL.md was published earlier as inngest/inngest-skills/inngest-realtime.
Inngest Realtime
Stream updates from durable Inngest functions to live UIs. Use channels and topics to broadcast progress, render workflow execution as it happens, or build bi-directional human-in-the-loop flows.
These skills are focused on TypeScript. For Python or Go, refer to the Inngest documentation for language-specific guidance. Core concepts apply across all languages.
⚠ CRITICAL: v3 vs v4 package selectionRealtime in Inngest v4 lives at the SDK subpathinngest/realtime. The standalone@inngest/realtimenpm package is a v3-era package and is NOT compatible with `inngest@4.x`. If your project is on v4 (the npm default), do not install@inngest/realtime. Use the imports below.Symptoms of using the wrong package on v4:TypeError: Cls is not a constructoron everyPUT /api/inngest, 401 on subscription tokens, type incompatibility onnew Inngest({ middleware: [...] }). Verify yourpackage.jsonshows"inngest": "^4.x"before reading further.
Prerequisites
- Inngest v4 SDK installed (
npm install inngest) — see theinngest-setupskill INNGEST_DEV=1set in.env.localfor local development (without it, the SDK demands cloud signing keys and 401s on token requests)- Local Inngest dev server running (
npx inngest-cli@latest dev) - Optional:
zodfor schema validation on topics
When to use Realtime
| Problem shape | Pattern | |
|---|---|---|
| Order status page animates as durable workflow steps complete | Per-run channel, publish per step, client subscribes | |
| AI agent streams tokens to a chat UI | Per-conversation channel, publish chunks, stream to browser | |
| Log tail for a long-running job | Single channel, log topic, append to UI | |
| Human-in-the-loop approval | Channel + waitForEvent, publish prompt, wait for response | |
| Admin dashboard with live order list | Global admin channel, fan-out from each function |
Architecture
Three pieces:
- Channel definition — a typed contract for what gets published. Lives in shared module so both server and client can reference the same channel name.
- Publishing — call
step.realtime.publishbetween steps to wrap a durable publish, orinngest.realtime.publishinsidestep.runbecause you're already inside a memoized step. See "Which publish method to use" below. - Subscribing — server action mints a subscription token; React client uses the
useRealtimehook (or the lower-levelsubscribe()API for non-React consumers).
Step 1: Define a channel
Channels are pure data — no class hierarchy, no zod runtime required (but recommended for type safety). Define them once and import where needed.
Two channel name shapes:
name: 'admin'— static channel, accessed asadminChannel.order(topic ref)name: (id) => 'channel:${id}'— parametric, accessed asorderChannel(id).step(call the channel def with the id, then access topic)
Step 2: Publish from inside a function
Inngest v4 ships realtime support natively — no middleware required. But where you call publish matters: it determines whether the publish is durable, and it's the most common place to get realtime wrong.
Which publish method to use
| Where you are | Use this | Why | |
|---|---|---|---|
Outside a step (top-level handler code, between step.run calls) | step.realtime.publish(id, topicRef, data) | Wraps the publish in its own step so it's durable, deduplicated by id, and retry-safe. | |
Inside a step (inside the callback passed to step.run) | inngest.realtime.publish(topicRef, data) | You're already inside a memoized step. step.realtime.publish would create a step inside a step. The bare client publish is the right call here. | |
| Outside a function (one-off route, script, etc.) | inngest.realtime.publish(topicRef, data) | Allowed, but not retry-safe — your client receiver must handle duplicates. |
The 90% rule: if you're writing handler code and you reach for publish, use step.realtime.publish. If you're writing code inside a step.run block and you reach for publish, use inngest.realtime.publish.
Example: both patterns in one function
Why no middleware: Earlier versions used @inngest/realtime's realtimeMiddleware() to inject a publish arg into the handler. v4 puts it on step.realtime and inngest.realtime directly.
Step 3: Mint a subscription token (server action)
In Next.js App Router, use a Server Action to securely mint a short-lived token for the React hook in Step 4. Without a token, clients can't subscribe.
getClientSubscriptionToken from inngest/react returns a token shape that the useRealtime hook in Step 4 consumes directly. No ChannelInstance stripping needed — that gotcha only applies to the lower-level getSubscriptionToken + manual subscribe() path (see "Pattern: Manual subscribe" below).
Step 4: Subscribe with the useRealtime hook
The recommended consumer for React/Next.js is the useRealtime hook from inngest/react. It handles the subscription lifecycle, reconnect, type narrowing per topic, and cleanup.
Useful options on the hook:
| Option | Default | Use it when | |
|---|---|---|---|
enabled | true | Delay the subscription until you have an ID (e.g., enabled: !!runId). | |
bufferInterval | 0 | Batch updates from a fast stream so React doesn't re-render per message. | |
pauseOnHidden | false | Pause the stream when the tab isn't visible (saves bandwidth). | |
autoCloseOnTerminal | true | Disconnect when the run completes — turn off to keep the stream open for fan-out channels. | |
historyLimit | unbounded | Cap how many messages are retained in messages.all. |
The hook returns messages.byTopic (latest per topic), messages.all (full history), messages.last (most recent), and messages.delta (new since last render).
Pattern: Manual subscribe (non-React or custom transport)
The useRealtime hook covers the React case. If you're not using React, or you need a custom subscription lifecycle (server-side streaming, background workers, custom protocols), use the lower-level subscribe() API directly.
Server action: mint a token with the lower-level helper
Manual client subscription
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/inngest-realtime/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/inngest/inngest-skills/inngest-realtime)