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

gRPC-Web wasm browser client implementation in tonic-web #645

Open
titanous opened this issue May 13, 2021 · 8 comments
Open

gRPC-Web wasm browser client implementation in tonic-web #645

titanous opened this issue May 13, 2021 · 8 comments
Labels
C-request Category: A feature request, i.e: not implemented / a PR.

Comments

@titanous
Copy link

Feature Request

Crates

tonic-web

Motivation

Now that gRPC-Web support has been implemented and merged by @alce (#455), I think it's worth considering adding support for a gRPC-Web client implementation that works in browsers. This will allow users that are writing frontend apps in Rust to use gRPC natively via tonic without leaving the Rust ecosystem.

Proposal

I propose adding a new Client type to tonic-web that implements GrpcService using the browser Fetch API via js-sys/wasm-bindgen. I have prototyped this implementation at https://github.com/titanous/grpc-web-client and am happy to work on a PR to merge in the implementation.

This would be behind a feature flag that is not enabled by default so that it can be used in projects that use wasm-bindgen to target browsers.

Alternatives

The alternative is to keep this implementation as a separate third-party crate, but I think that it would be better for the ecosystem to have an easy to find implementation available in tonic.

@davidpdrsn davidpdrsn added the C-request Category: A feature request, i.e: not implemented / a PR. label May 13, 2021
@rubik
Copy link

rubik commented May 14, 2021

@titanous Is your implementation meant to replace https://github.com/grpc/grpc-web and https://github.com/improbable-eng/grpc-web?

@titanous
Copy link
Author

@titanous Is your implementation meant to replace https://github.com/grpc/grpc-web and https://github.com/improbable-eng/grpc-web?

Only for Rust use, I don’t plan to export JS bindings.

@ProjectMoon
Copy link

Is it suitable to use the grpc-web-client prototype crate as an actual grpc web client today? I notice it points against branches of tonic that no longer exist.

@titanous
Copy link
Author

titanous commented Jun 3, 2021

It should work if you point it at the lastest tonic master. I am planning to send a PR that will integrate it into this repository soon.

@theduke
Copy link

theduke commented Apr 15, 2022

Any way to get this effort going again?
Seeing this merged into tonic would be awesome.

@mattoni
Copy link

mattoni commented Dec 3, 2022

I too would like to see this implemented. I'm working on a full-stack rust app and using gRPC would be fantastic.

@Miuler
Copy link

Miuler commented Jun 17, 2023

What's new?

@Miuler
Copy link

Miuler commented Jun 17, 2023

I have only seen this alternative: https://github.com/devashishdxt/tonic-web-wasm-client
:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

7 participants