When collecting information on how to write GRPC or Websocket servers for our Qovery infrastructure, I came across a lot of resources. But while many guides provided an in-depth insight into futures, they sorely lacked information on how the Stream API works in Rust. And, more importantly, on how to use it properly. Sadly, you can't turn a blind eye on streams. As soon as you go beyond the simple request/response protocol of our beloved REST APIs, the notions of flow, async generator, and so on, inevitably arise. This is especially true when it comes to Rust. When you decide to use tonic for your GRPC or tokio tungstenite for your Websocket, the only usable interfaces with those libraries revolve around streams. This is why this article focuses on introducing streams in the context of Rust.
Romain Gérard
Staff Software Engineer