Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client side support for http streaming #5506

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

siggisim
Copy link
Member

Client side support for server-side grpc streaming over http.

This is behind a app.streaming_http_enabled flag.

If that flag is enabled, we'll do three things:

There is a TODO in there to support messages that come across chunks. This should be relatively straightforward to implement, but I haven't run into it in my testing - and would like to run into it before fixing.

Depends on: #5505

Copy link
Member

@bduffany bduffany left a comment

Choose a reason for hiding this comment

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

How does this work in terms of the proto API? Will this let us write streaming RPC methods now or is there some additional codegen support needed? (IIRC the protobufjs codegen doesn't generate code for streaming APIs?)

@siggisim
Copy link
Member Author

How does this work in terms of the proto API? Will this let us write streaming RPC methods now or is there some additional codegen support needed? (IIRC the protobufjs codegen doesn't generate code for streaming APIs?)

Here's an example:

    rpc_service.service.on("data", (response, method) => {
      // Todo probably check that you're dealing with the right method here
      console.log(response);
    });

    rpc_service.service.streamBuildLog(request);

We could probably do something fancy to make this nicer, but I don't think this is so bad.

while (true) {
let result = await reader?.read();
if (result?.done) {
break;
Copy link
Member

Choose a reason for hiding this comment

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

should this be return ? Seems like we'll do another fetch after this break, guessing that's not intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I am struggling with returns today lol.

I tested this a bunch without the fallback case at the bottom - and then added the fallback to support hiding this behind a flag, and guess I didn't notice the extra fetch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@siggisim siggisim requested a review from bduffany December 12, 2023 00:11
@siggisim siggisim merged commit 056ec53 into master Dec 12, 2023
1 check failed
@siggisim siggisim deleted the siggi-dev-branch-20231211-142951 branch December 12, 2023 20:00
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.

2 participants