Rust implementation of grpc-web
protocol that allows
using tonic
in browsers via webassembly.
To use tonic-web-wasm-client
, you need to add the following to your Cargo.toml
:
toml
[dependencies]
tonic-web-wasm-client = "0.2"
To use tonic
gRPC clients in browser, compile your code with tonic's transport
feature disabled (this will disable
the default transport layer of tonic). Then initialize the query client as follows:
```rust use tonicwebwasm_client::Client;
let baseurl = "http://localhost:9001"; // URL of the gRPC-web server
let queryclient = QueryClient::new(Client::new(base_url)); // QueryClient
is the client generated by tonic
let response = query_client.status().await; // Execute your queries the same way as you do with defaule transport layer ```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.