In contrast, when using the commented out code below instead, it properly blocks after having sent the message and waits for more messages from the server.
let outbox = stream::iter_ok::<_, WebSocketError>(messages);
boxed!(stream
.send(messages[0].clone())
.map(|sink| Loop::Continue(sink))
.map_err(move |e| format!("Could not send message: {}", e).into()))
Am I doing something wrong? Shouldn't send and send_all behave similarly?
I have a problem that probably results from a misunderstanding of the Tokio stack and/or your library, so I apologize in advance :)
I'm trying to implement the SaltyRTC client protocol using rust-websocket. The handshake messages are handled inside a
future::loop_fn
loop.If you look at this file, the current code which uses
send_all
to send messages terminates the stream after having sent all messages.In contrast, when using the commented out code below instead, it properly blocks after having sent the message and waits for more messages from the server.
Am I doing something wrong? Shouldn't
send
andsend_all
behave similarly?