Kumoko

A simple asynchronous server/client crate built on tokio for easy two-way streaming.

![crates-badge] license

Website | API Docs

Unstable Warning!

Motivation

Enable asynchronous full duplex streaming of semi-complex data-structures between a rust server and clients. gRPC implementations are suboptimal for this:

Features

Examples

In your Cargo.toml: toml [dependencies] kumoko = { version = "0.4", features = ["full"] } tokio = { version = "1.20", features = ["macros", "rt-multi-thread"] }

Minimal Client: ```rust use kumoko::client::Client;

[tokio::main]

async fn main() -> Result<(), Box> { let mut client = Client::connect("[::1]:50052").await?;

client.send_request("Ferris".to_string()).await;
let msg: String = client.get_response().await.unwrap();
println!("{}", msg);

Ok(())

} ```

Minimal Server: ```rust use kumoko::server::Server;

[tokio::main]

async fn main() -> Result<(), Box> { let mut server = Server::::bind("[::1]:50052").await?;

loop{
    let (req, origin) = server.get_request().await;

    let msg = format!("Hello {}! Happy to see you here!", req);
    server.send_response(msg, origin.into()).await;
}

} ```