Returns an unique and properly formatted inbox subject that can be used for replies
Closes the connection to the NATS server. A closed client cannot be reconnected.
Drains all subscriptions. Returns a Promise that when resolved, indicates that all subscriptions have finished, and the client closed. Note that after calling drain, it is impossible to create new subscriptions or make any requests. As soon as all messages for the draining subscriptions are processed, it is also impossible to publish new messages. A drained connection is closed when the Promise resolves.
Flush outbound queue to server and call optional callback when server has processed all data.
is optional, if not provided a Promise is returned. Flush is completed when promise resolves.
Promise
true if the NATS client is closed.
Report number of subscriptions on this connection.
Publish a message to the given subject, with optional payload and reply subject.
optional (can be a string, JSON object, or Buffer. Must match [[NatsConnectionOptions.payload].)
optional
Publish a request message with an implicit inbox listener as the reply. Message is optional. This should be treated as a subscription. The subscription is auto-cancelled after the first reply is received or the timeout in millisecond is reached.
If a timeout is reached, the promise is rejected. Returns the received message if resolved.
optional (can be a string, JSON object, or Buffer. Must match specified Payload option)
Promise
Subscribe to a given subject. Messages are passed to the provided callback.
Optional subscription options
Promise
Generated using TypeDoc
NATS server Client object.