Skip to content

docs: use async functions in gRPC streaming examples#2203

Open
bonnywelsford-source wants to merge 7 commits into
mainfrom
docs/grpc-streaming-async-examples
Open

docs: use async functions in gRPC streaming examples#2203
bonnywelsford-source wants to merge 7 commits into
mainfrom
docs/grpc-streaming-async-examples

Conversation

@bonnywelsford-source

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new "Streaming requires async functions" section explaining that gRPC streaming event handlers can only fire when the call stack is empty, so the default function must be async.
  • Updates the server streaming and client streaming examples to use async/await with Promise, replacing the previous synchronous sleep()-based approach.
  • Adds stream.on('error', ...) handlers to both examples.

Addresses customer feedback that the gRPC streaming docs didn't explain the need for async functions, making it difficult to get streaming to work.

Applies to next/ and v1.6.x.

Test plan

  • Verify the page builds locally (npm start, visit http://localhost:3002/docs/k6/next/using-k6/protocols/grpc/)
  • Confirm the new "Streaming requires async functions" section renders between "Unary gRPC requests" and "Server gRPC streaming"
  • Review the server and client streaming code examples for correctness
  • Check the v1.6.x version matches the next/ version

Made with Cursor

Streaming event handlers can only fire when the call stack is empty,
so synchronous default functions prevent them from running. Update the
server and client streaming examples to use async/await with Promises
and add a short explanation of why async is required.

Applies to next/ and v1.6.x.

Made-with: Cursor
@bonnywelsford-source bonnywelsford-source requested review from ankur22 and szkiba and removed request for a team March 6, 2026 19:34
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

💻 Deploy preview available (docs: use async functions in gRPC streaming examples):

All code blocks on this page require a gRPC server at 127.0.0.1:10000
which is not available in CI. Skip the entire file, matching the
pattern used by other external-service docs (Redis, MQTT, etc.).

Made-with: Cursor
@heitortsergent

Copy link
Copy Markdown
Collaborator

@bonnywelsford-source this looks good to me, but it would be nice to get one of the engineers to double-check this. @andrewslotin do you know if anyone on the squad might be able to take a quick look at this? 🙇

We also would need to update the v1.7.x version of the page before merging.

@heitortsergent heitortsergent added the Area: OSS Content Improvements or additions to community/oss documentation label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OSS Content Improvements or additions to community/oss documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants