async_nats

Function connect_with_options

source
pub async fn connect_with_options<A: ToServerAddrs>(
    addrs: A,
    options: ConnectOptions,
) -> Result<Client, ConnectError>
Expand description

Connects to NATS with specified options.

It is generally advised to use ConnectOptions instead, as it provides a builder for whole configuration.

ยงExamples

let mut nc =
    async_nats::connect_with_options("demo.nats.io", async_nats::ConnectOptions::new()).await?;
nc.publish("test", "data".into()).await?;