syndicate-rs/examples/consumer.rs

13 lines
451 B
Rust
Raw Normal View History

2020-05-11 20:02:56 +00:00
use syndicate::{packets, value::Value};
use tokio::net::TcpStream;
use tokio_util::codec::Framed;
use futures::SinkExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut frames = Framed::new(TcpStream::connect("127.0.0.1:8001").await?,
packets::ClientCodec::standard());
2020-05-11 20:08:27 +00:00
frames.send(packets::C2S::Connect(Value::from("producer-consumer-example").wrap())).await?;
2020-05-11 20:02:56 +00:00
Ok(())
}