Hi,
Im following the routeguide tutorial and am wondering if there is a way for detecting when a client drops when working with bidirectional streams.
Here is the code snippet:
in the bidirectional stream, how can know if a client was not able to receive the response?
async fn route_chat(
&self,
request: Request<tonic::Streaming<RouteNote>>,
) -> Result<Response<Self::RouteChatStream>, Status> {
println!("RouteChat");
let mut notes = HashMap::new();
let mut stream = request.into_inner();
let output = async_stream::try_stream! {
while let Some(note) = stream.next().await {
let note = note?;
let location = note.location.clone().unwrap();
let location_notes = notes.entry(location).or_insert(vec![]);
location_notes.push(note);
for note in location_notes {
yield note.clone();
}
}
};
Ok(Response::new(Box::pin(output)))
}
Any help would be appreciated.
Hi,
Im following the routeguide tutorial and am wondering if there is a way for detecting when a client drops when working with bidirectional streams.
Here is the code snippet:
Any help would be appreciated.