Table of Contents
Introduction
Protocol Buffer
Rust and gRPC
Creating a Server
Creating a Client
Streaming in gRPC
Authentication
Concl...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Anshul, I am very new to Rust development, i find this article extremely helpful, however I am not quite clear with the statement below:
is this referring to the bin block in the
cargo.toml
? is so, may I know what would be the proper way to run the rust grpc server?Yes, the better way is to use cargo wrokspaces.
Thanks Anshul, I have been looking at different gRPC crates and I think another way that to not use the
cargo run --bin server
is to use the statically generated code fromprotoc --rust_out
and use them to build the grpc server manually.Particularly I found github.com/tikv/grpc-rs.
I understood completely that this article was meant to demonstrate the dynamically genarated grpc server & client, so I hope this comment is not to be taken in the wrong light.
Hi, Sean I always like to generate stubs at build time. It allows us to maintain a sync between protocol buffer definations and stubs. I think it is best practice to not to generate stubs before hand.
yup, agreed, generating stub at build time guarantees the latest protobuf code, that's my preference too.
Hi Anshul,
Nice post. Thanks.
A question about CA. You used self-signed CA. and I did same like your posted. But my client cannot talk to server. It tells me
transport error
.After checking online, I found that
libwebpki
said they are not supporting self-signed CA currently. (Link is here: github.com/briansmith/webpki/issue...)Could you describe more for CA part? Thanks
Best,
Marshal
HI! I'm having a trouble with streaming. I cloned your repo and ran server and cient. I tried function send_stream but modified it putting sleep(4 second) for each iteration in the spawned task. When I ran client I was expecting a short delay between messages I receive from the server but it worked differently. The delay took about 20 seconds without any incoming messages (4 iterations with 4 sleeps per eacn) and then I got all the messages at the moment. Why does it happen and how can I make streaming send and receive in time?
I've set channel buffer size to 1 and it seems to be working but I don't undestand why
Hi!
Very thanks for your tutorial. Not so simple, not so complex. The just point.
Now I recommed to update the code for this days, changes a bit. I've shared my repo
gitlab.com/pineiden/gprc-tonic-rust
BR
good sample, had to tweak the JWT sample code.
had to change
mut req: Request
to
mut req: tonic::Request
Can you point to the complete code repository ?
He would have to add it, because it doesn't seem to be on his github.
for some small points, the name of the
impl
has to beSay
(given by the.proto
), the filehell.rs
should probably have beenhello.rs
and is placed in foldersrc
. This is my findings so far.This should bring you to a state where if you have not added anything to your implementation the compiler will spit at you:
not all trait items implemented, missing: ...
which makes perfect senseHere is the repo github.com/anshulrgoyal/rust-grpc-...
I was using 2 bin. But
hello module is not getting imported to client.rs.
My src folder structure
client.rs
server.rs
hello.rs
Not sure whether I need to make lib.rs
Hi
Sorry for the late reply.
Here is the code repo github.com/anshulrgoyal/rust-grpc-...
Thank you.
Very good post! This is exactly what I needed 😁
title "Token-Based Authentication" is not correct show.
"use" is missing before "jsonwebtoken crate".