async-nats 0.49.1

A async Rust NATS client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[tokio::main]
async fn main() -> Result<(), async_nats::Error> {
    // NATS-DOC-START
    // Connect to NATS demo server
    let client = async_nats::connect("demo.nats.io").await?;

    // Publish a message to the subject "hello"
    client.publish("hello", "Hello NATS!".into()).await?;
    client.flush().await?;

    println!("Message published to hello");
    // NATS-DOC-END

    Ok(())
}