• Public
  • Public/Protected
  • All


  • NatsConnectionOptions



Optional encoding

encoding: BufferEncoding

Sets the encoding type used when dealing with Payload.STRING messages. Only node-supported encoding allowed.

Optional maxPingOut

maxPingOut: undefined | number

Maximum number of client PINGs that can be outstanding before the connection is considered stale.

Optional maxReconnectAttempts

maxReconnectAttempts: undefined | number

Maximum number of consecutive reconnect attempts before the client closes the connection. Specify -1 to retry forever.

Optional name

name: undefined | string

A name for the client. Useful for identifying a client on the server monitoring and logs.

Optional nkey

nkey: undefined | string

Public NKey Identifying the user.

Optional nkeyCreds

nkeyCreds: undefined | string

nkey file path - will automatically setup an nkey and nonceSigner that references the specified nkey seed file.

Optional noEcho

noEcho: undefined | false | true

Requires server support 1.2.0+. When set to true, the server will not forward messages published by the client to the client's subscriptions. By default value is ignored unless it is set to true explicitly

Optional noRandomize

noRandomize: undefined | false | true

When true does not randomize the order of servers provided to connect.

Optional nonceSigner

nonceSigner: NonceSigner

Nonce signer - a function that signs the nonce challenge sent by the server.

Optional pass

pass: undefined | string

User password.

Optional payload

payload: Payload

Specifies the payload type of the message. See Payload. Payload determines Msg.data types and types published.

Optional pingInterval

pingInterval: undefined | number

Interval in milliseconds that the client will send PINGs to the server. See NatsConnectionOptions.maxPingOut

Optional port

port: undefined | number

Specifies the port on the localhost to make a connection.

Optional reconnect

reconnect: undefined | false | true

Specifies whether the client should attempt reconnects.

Optional reconnectTimeWait

reconnectTimeWait: undefined | number

Specifies the interval in milliseconds between reconnect attempts.

Optional servers

servers: Array<string>

A list of server URLs where the client should attempt a connection.

Optional timeout

timeout: undefined | number

number of milliseconds when making a connection to wait for the connection to succeed. Must be greater than zero.

Optional tls

tls: boolean | TlsOptions

If true, or set as a tls.TlsOption object, requires the connection to be secure. Fine grain tls settings, such as certificates can be specified by using a tls.TlsOptions object.

Optional token

token: undefined | string

Token to use for authentication.

Optional url

url: undefined | string

Server URL where the client should attempt a connection

Optional user

user: undefined | string

NATS username.

Optional userCreds

userCreds: undefined | string

Credentials file path - will automatically setup an nkey and nonceSigner that references the specified credentials file.

Optional userJWT

userJWT: string | JWTProvider

A JWT identifying the user. Can be a static JWT string, or a function that returns a JWT when called.

Optional waitOnFirstConnect

waitOnFirstConnect: undefined | false | true

If true, the client will perform reconnect logic if it fails to connect when first started. Normal behaviour is for the client to try the supplied list of servers and close if none succeed.

Optional yieldTime

yieldTime: undefined | number

Specifies the max amount of time the client is allowed to process inbound messages before yielding for other IO tasks. When exceeded the client will yield.


  • Property
  • Method
  • Property
  • Inherited method

Generated using TypeDoc