-
Notifications
You must be signed in to change notification settings - Fork 7
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
Sending multiple response to a received request #91
Comments
I should thanks to @tobz for his kind helps, the solution is: let task = rx
.inspect(|_| {
println!("new message received");
}).map(|_| {
stream::iter_ok::<_, io::Error>(vec![Msg::ACK, Msg::PONG])
}).flatten().forward(tx)
.then(|_| Ok(())); |
@carllerche this issue has been resolved, should I close it or I should make a doc for it? |
@alishir sorry for the delay, do you have thoughts on how the docs (Tokio guides) could be improved to cover this case? |
@carllerche sorry for late reply, I think a cheat sheet that covers future to future or stream conversion and vise versa can solve the problem, during programming with tokio in many times I found that I should convert this future to other future or stream, or run multiple future together but I couldn't find any example. |
It is not a bug report, it is a help request.
I want to implement simple network protocol like following diagram:
I implemented simple server with simple codec that can decode
ping
messages, I can get the ping request and send the ack response, but I don't know how should I send thepong
response.I'm using netcat
nc 127.0.0.1 6142
to interact with the server, server sendACK
response well.Here is the source code and repo:
The text was updated successfully, but these errors were encountered: