Skip to content

netxp1318/streamfly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamFly

StreamFly aims to be a stream-oriented Pub/Sub framework.

Quickstart

Cargo.toml

[dependencies]
streamfly = "0.1"
  • create a streamfly client
let mut client = new_client(
    "127.0.0.1:1318".parse()?,
    "localhost",
    Path::new("./certs/cert.pem"),
)
.await?;
  • subscribe streams, and then receive data
let rx = client.subscribe(CHANNEL).await?;

loop {
    let (_, mut reader) = rx.recv().await?;

    tokio::spawn(async move { tokio::io::copy(&mut reader, &mut tokio::io::stdout()).await });
}
  • publish a stream, and then write data to the stream
let (stream_id, mut writer) = client.open_stream(CHANNEL).await?;

writer.write_all(b"Hello, Streamfly!").await?;

Build

  • build streamfly cli command
RUSTFLAGS="--cfg s2n_quic_unstable" cargo build
  • build examples
RUSTFLAGS="--cfg s2n_quic_unstable" cargo build --examples

Run the demo

  • start the streamfly server
RUST_LOG=debug ./target/debug/streamfly serve
  • start a receiver
RUST_LOG=debug ./target/debug/examples/sub
  • start a sender
RUST_LOG=debug ./target/debug/examples/pub
  • you can start another receiver
RUST_LOG=debug ./target/debug/examples/sub

About

stream-oriented Pub/Sub framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages