Object - nats : Connection

Represents a single network connection to the NATS server.

Constructor

__init

(string url, ConnectionConfig? config)

  • url string
  • NATS Broker URL. For a clustered use case, pass the URLs as comma-separated values.

  • config ConnectionConfig? ()
  • Information necessary for the NATS client to establish a connection with the server.

Methods

close

(boolean? forceful)

returns Error?

Closes a given connection.

Parameters

  • forceful boolean? (default ())
  • The graceful shutdown flag. If true, the connection closes immediately. By default, this is set to false.

  • Return Type

    (Error?)
  • Returns () or the error if unable to complete the close operation.