Skip to content

disconnect

disconnect(): Promise<boolean>

Disconnects from the CORD blockchain and clears the cached connection.

Returns

Promise<boolean>

A promise resolving to a boolean indicating successful disconnection.

Remarks

Should be invoked to cleanly close the connection when no longer needed.

Example

import { connect, disconnect } from './CordConfig';
const wsUrl = 'ws://localhost:9944';
connect(wsUrl).then(() => disconnect()).then(disconnected => {
console.log('Disconnected:', disconnected);
}).catch(error => {
console.error('Error:', error);
});

Source

config/src/Config.ts:126