From 8dbbfd922a100d692592d7e24a347e28630bd721 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 11 May 2020 22:02:56 +0200 Subject: [PATCH] Start of a consumer example --- examples/consumer.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/consumer.rs diff --git a/examples/consumer.rs b/examples/consumer.rs new file mode 100644 index 0000000..1f28c29 --- /dev/null +++ b/examples/consumer.rs @@ -0,0 +1,12 @@ +use syndicate::{packets, value::Value}; +use tokio::net::TcpStream; +use tokio_util::codec::Framed; +use futures::SinkExt; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let mut frames = Framed::new(TcpStream::connect("127.0.0.1:8001").await?, + packets::Codec::::standard()); + frames.send(packets::In::Connect(Value::from("producer-consumer-example").wrap())).await?; + Ok(()) +}