Table of Contents

Property Url

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

Url

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

public string Url { get; init; }

Property Value

string

Remarks

You can set more than one server as seed servers in a comma-separated list. The client will randomly select a server from the list to connect to unless NoRandomize (which is false by default) is set to true.

User-password or token authentication can be set in the URL. For example, nats://derek:s3cr3t@localhost:4222 or nats://token@localhost:4222. You can also set the username and password or token separately using AuthOpts; however, if both are set, the AuthOpts will take precedence. 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.