disconnect(), then releases the internal resources of the client, clears the cached configuration, and removes all event listeners. Call this method when the client is no longer needed, for example, on page unload. If you call it more than once, the later calls do nothing. After you destroy the client, you can’t reuse the instance. If you call connect() on it, the call fails with Client has been destroyed.
Signature
Parameters
None.Returns
Promise<void>
Throws
An error if the cleanup process fails. The error messages start withFailed to destroy client:.