dispose method

  1. @override
Future<void> dispose()
override

Perform cleanup

Implementation

@override
Future<void> dispose() async {
  this._logger.info("Closing gateway connections...");

  for(final shard in this._shards.values) {
    if(this._ws._client._options.shutdownShardHook != null) {
      this._ws._client._options.shutdownShardHook!(this._ws._client, shard); // ignore: unawaited_futures
    }
    shard.dispose(); // ignore: unawaited_futures
  }

  await this._onConnect.close();
  await this._onDisconnect.close();
  await this._onMemberChunk.close();
}