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

subscriber: add grpc-web support to console-subscriber #497

Closed
Rustin170506 opened this issue Dec 1, 2023 · 4 comments
Closed

subscriber: add grpc-web support to console-subscriber #497

Rustin170506 opened this issue Dec 1, 2023 · 4 comments
Labels
S-feature Severity: feature. This is adding a new feature.

Comments

@Rustin170506
Copy link
Collaborator

What problem are you trying to solve?

Currently, we only support standard gRPC. However, if we aim to develop a web console in the browser, it will require the use of grpc-web to connect to the console-subscriber. Since grpc-web only supports HTTP 1.1, we cannot directly connect to the console-subscriber. To facilitate this, we must use envoy as a proxy for forwarding. While this approach is effective, it introduces a new component to the system.

How should the problem be solved?

Because tonic has tonic-web layer, we can add a new feature to help users to enable it. Then we can connect the console-subscriber with grpc-web. I have implemented it. It worked well.

Any alternatives you've considered?

Use envoy as a proxy to workaround.

How would users interact with this feature?

Users only need to enable the grpc-web or web feature.

Would you like to work on this feature?

yes

@Rustin170506 Rustin170506 added the S-feature Severity: feature. This is adding a new feature. label Dec 1, 2023
@hawkw
Copy link
Member

hawkw commented Dec 1, 2023

This seems like a good idea to me! A web console would be neat to have eventually!

hds added a commit that referenced this issue Feb 16, 2024
## Description

This pull request adds support for `grpc-web` to `console-subscriber`.
Once you enable this feature by calling the `enable_grpc_web` function,
you can connect the console-subscriber gRPC server using a browser
client.

## Explanation of Changes

1. Added a new feature called `grpc-web` which requires the `tonic-web`
   crate as a dependency.
2. A new API named `serve_with_grpc_web` has been introduced. It appears
   to be similar to the `serve_with` API. However, if we were to use the
   same API with `serve_with`, it would result in a bound issue. We
   attempted to combine `serve_with_grpc_web` and `serve_with`, but it
   would create a very complex trait bound for the function. Therefore,
   we decided to introduce a new API to address this problem.
4. Added a new example named `grpc_web` to show how to use the
   `into_parts` API to customize the CORS layer.

Ref #497

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Co-authored-by: Hayden Stainsby <hds@caffeineconcepts.com>
@yerke
Copy link
Contributor

yerke commented Feb 27, 2024

@hi-rustin since #498 got merged, should this issue be closed?

@Rustin170506
Copy link
Collaborator Author

Yes, I think we can close it now.

@Rustin170506
Copy link
Collaborator Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-feature Severity: feature. This is adding a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants