ServerInfo to the currently connected server or undefined
Close will close the connection to the server. This call will terminate all pending requests and subscriptions. The returned promise resolves when the connection closes.
Returns a promise that can be used to monitor if the client closes. The promise can resolve an Error if the reason for the close was an error. Note that the promise doesn't reject, but rather resolves to the error if there was one.
Initiates a drain on the connection and returns a promise that resolves when the drain completes and the connection closes.
Drain is an ordered shutdown of the client. Instead of abruptly closing the client, subscriptions are drained, that is messages not yet processed by a subscription are handled before the subscription is closed. After subscriptions are drained it is not possible to create a new subscription. Then all pending outbound messages are sent to the server. Finally, the connection is closed.
Returns a Promise that resolves when the client receives a reply from the server. Use of this API is not necessary by clients.
Returns the hostport of the server the client is connected to.
Returns true if the client is closed.
Returns true if the client is draining.
Publishes the specified data to the specified subject.
Publishes a request with specified data in the specified subject expecting a response before timeout milliseconds. The api returns a Promise that resolves when the first response to the request is received. If there are no responders (a subscription) listening on the request subject, the request will fail as soon as the server processes it.
the number of milliseconds it took for a flush.
Returns some metrics such as the number of messages and bytes sent and recieved by the client.
Subscribe expresses interest in the specified subject. The subject may have wildcards. Messages are delivered to the SubscriptionOptions callback if specified. Otherwise, the subscription is an async iterator for Msg.
Generated using TypeDoc