Closed mahdi-shojaee closed 3 years ago
Thanks for feedback! Can you show your client-side acceptor(...)
code snippet? I need some information for debugging.
v0.6.0
is ok, it's the latest released version. The next version v0.7.0
will be released when tokio-v1
supported.
Sure:
use std::time::Duration;
use rsocket_rust::prelude::*;
use rsocket_rust::Result;
use rsocket_rust_transport_tcp::TcpClientTransport;
#[tokio::main]
async fn main() -> Result<()> {
let client = RSocketFactory::connect()
.transport(TcpClientTransport::from("127.0.0.1:7878"))
.acceptor(Box::new(|| Box::new(EchoRSocket)))
.start()
.await
.expect("connection failed!");
loop {
tokio::time::sleep(Duration::from_secs(1)).await;
let req = Payload::builder().set_data_utf8("Mahdi").build();
let res = client.request_response(req).await.expect("request failed!");
println!("response: {:?}", res);
}
}
[dependencies]
tokio = { version = "0.3.6", features = ["full"] }
rsocket_rust = "0.6.0"
rsocket_rust_transport_tcp = "0.6.0"
I actually added the loop to ensure that client is running and can receive messages from the server while sending messages to the server.
Actually, the acceptor is an EchoRSocket
.
It's a bug. It will be fixed soon. Thanks for reporting 👍
It will be released with v0.7.0
in the next few days. Thanks!
By the way, you can use client.wait_for_close().await
to block it until client disconnected from v0.7.0
.
Ok, Thanks. My key feature for RSocket is that after the connection is established, server can also call the client. What are the main risks if I want to use it in production! (I know you mentioned do not) instead of gRPC? Also what about performance compared to gRPC (tonic)? Are you did any comparisons?
RSocket is a network protocol instead of a RPC framework. Community has a similar framework called RSocket RPC, it uses the gRPC IDL but uses RSocket as transport layer.
The main risk is that it has not been fully tested and many advance features need to be implemented.
I wote a simple echo benchmark, 1 KB payload by default. You can run it with just e
and just b
. In my MBP 2015, score is 110K QPS.
To be honest, we still need to do a lot of performance tuning work.
Nice, Thanks for your explanations.
@mehdishojaei the v0.7.0
has been released, feel free if you have any question. Thanks! 😃
Well done, I will check it in the next few days. Thanks.
Thanks for this nice crate,
Sending a request to the client in the callback of the acceptor method fails.
Expected Behavior
Expected to request_response method return the response for the request.
Actual Behavior
request_response method returns error:
Steps to Reproduce
Your Environment
Darwin Mahdis-MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
Cargo.toml dependencies
I also tried the "0.5.1" with the appropriate tokio version and also the git master branch.
Any suggestion?