Table of Contents

Constructor NatsClient

Namespace
NATS.Net
Assembly
NATS.Client.Simplified.dll

NatsClient(string, string, string?)

Initializes a new instance of the NatsClient class.

public NatsClient(string url = "nats://localhost:4222", string name = "NATS .NET Client", string? credsFile = null)

Parameters

url string

NATS server URL to connect to. (default: nats://localhost:4222)

name string

Client name. (default: NATS .NET Client)

credsFile string

Credentials filepath.

Remarks

You can set more than one server as seed servers in a comma-separated list in the url. The client will randomly select a server from the list to connect.

User-password or token authentication can be set in the url. For example, nats://derek:s3cr3t@localhost:4222 or nats://token@localhost:4222. You should URL-encode the username and password or token if they contain special characters.

If multiple servers are specified and user-password or token authentication is used in the url, only the credentials in the first server URL will be used; credentials in the remaining server URLs will be ignored.

NatsClient(NatsOpts, BoundedChannelFullMode)

Initializes a new instance of the NatsClient class.

public NatsClient(NatsOpts opts, BoundedChannelFullMode pending = BoundedChannelFullMode.Wait)

Parameters

opts NatsOpts

NATS client options.

pending BoundedChannelFullMode

Sets SubPendingChannelFullMode option. (default: wait)

Remarks

By default, the opts will be merged with the default options overriding SerializationRegistry with Default and SubPendingChannelFullMode with Wait.