rsocket-rust icon indicating copy to clipboard operation
rsocket-rust copied to clipboard

rsocket channel request stream is moved into function

Open Algorab opened this issue 1 year ago • 4 comments

The function definition for channel is this fn request_channel(&self, reqs: Flux<Result<Payload>>) -> Flux<Result<Payload>> where flux is defined as Flux<T> = Pin<Box<dyn Send + Stream<Item = T>>>;

To request a channel it is required to put in a stream and get then a stream for receiving elements back.

When I want to send more elements after the first initial request to the rsocket server as far as I see this is not possible, due the variable is moved into the function and a clone is also not possible.

Expected have the possibility to add more elements to the request stream for a existing connection

Algorab avatar Jun 19 '24 12:06 Algorab

You can use a channel, use the Rx as the reqs, and produce messages over Tx.

jjeffcaii avatar Jun 26 '24 12:06 jjeffcaii

Oh this is great. Did not see it. An example at the examples would be useful, if I not oversee it.

Algorab avatar Jun 26 '24 13:06 Algorab

Have this now working, this show how to do it => https://docs.rs/tokio/latest/tokio/stream/index.html

Algorab avatar Jul 17 '24 12:07 Algorab

An other question: What is the best suggestion for implementing a reconnect in a channel connection ?

Algorab avatar Jul 17 '24 12:07 Algorab