Expand description
STREAM socket module of Pub-Sub pattern in ZMQ
Use the stream
function to instantiate a stream socket and use methods
from the Stream
/StreamExt
traits.
A stream socket is for interacting with TCP data from sources other than ZMQ. It is not compatible with any of the other ZMQ socket types.
Example
use async_zmq::{Result, StreamExt};
#[async_std::main]
async fn main() -> Result<()> {
let mut zmq = async_zmq::stream("tcp://127.0.0.1:5555")?.bind()?;
while let Some(msg) = zmq.next().await {
// Received message is a type of Result<MessageBuf>
let msg = msg?;
println!("{:?}", msg.iter());
}
Ok(())
}
Structs
- The async wrapper of ZMQ socket with STREAM type
Functions
- Create a ZMQ socket with STREAM type