Skip to content

feat(client, server): add keep-alive for streaming batch responses - #1657

Merged
dinwwwh merged 3 commits into
middleapi:mainfrom
dinwwwh:feat/batch-response-keep-alive
Jul 11, 2026
Merged

feat(client, server): add keep-alive for streaming batch responses#1657
dinwwwh merged 3 commits into
middleapi:mainfrom
dinwwwh:feat/batch-response-keep-alive

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Jul 10, 2026

Copy link
Copy Markdown
Member

Send zero-length length-prefixed frames while streaming batch responses are idle (default 15s, configurable).

Send zero-length length-prefixed frames while streaming batch
responses are idle (default 15s, configurable).
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview, Comment Jul 10, 2026 11:44pm

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1657

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@1657

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1657

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@1657

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1657

@orpc/experimental-effect

npm i https://pkg.pr.new/@orpc/experimental-effect@1657

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@1657

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1657

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1657

@orpc/next

npm i https://pkg.pr.new/@orpc/next@1657

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1657

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@1657

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@1657

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@1657

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@1657

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1657

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1657

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1657

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1657

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1657

commit: 3832cc4

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two issues need attention before merging: the keepAlive.enabled option is typed as required (so { interval: ... } is rejected), and enabling keep-frames by default breaks backward compatibility with older clients that don't skip zero-length frames.

Reviewed changes — added server-side keep-alive frames for streaming batch responses and updated the client decoders to ignore zero-length frames.

  • Add keepAlive option to BatchHandlerPlugin — configurable enabled/interval for streaming mode only.
  • Send zero-length length-prefixed frames from the server while the streaming batch response is idle, with timer lifecycle management.
  • Skip zero-length frames in decodeLengthPrefixedBlob and decodeLengthPrefixedStream so clients tolerate keep-alive frames.
  • Document keep-alive in apps/content/docs/plugins/batch.md and reorder the Filtering Requests section.
  • Add tests for both client and server keep-alive behavior.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/server/src/plugins/batch.ts
Comment thread packages/server/src/plugins/batch.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest commit only reordered documentation, so the two issues flagged in the prior review remain unaddressed (the related review threads were resolved without corresponding code changes).

Reviewed changes — commit 9a61c719 moved the Filtering Requests section in apps/content/docs/plugins/batch.md; packages/server/src/plugins/batch.ts was not changed.

  • Reordered apps/content/docs/plugins/batch.md so Filtering Requests appears after Groups.
  • No code changes since the prior review.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/server/src/plugins/batch.ts
Comment thread packages/server/src/plugins/batch.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The streaming-only scope change is a good cleanup, but the two issues raised in prior reviews are still present in the current code.

Reviewed changes — commit 3832cc4a narrowed keep-alive to streaming mode by removing the blob test and zero-length-frame handling.

  • Scoped keep-alive to streaming mode — removed the buffered/blob client test and decodeLengthPrefixedBlob handling.
  • Kept stream decoder handling unchangeddecodeLengthPrefixedStream still skips zero-length frames and has a passing streaming test.
  • Did not change the server plugin API or defaultskeepAlive.enabled is still typed as required and still defaults to true.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/server/src/plugins/batch.ts
Comment thread packages/server/src/plugins/batch.ts
Comment thread packages/server/src/plugins/batch.ts
@dinwwwh
dinwwwh merged commit 5e2865c into middleapi:main Jul 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant