disconnect method

Future<void> disconnect(
  1. NwcConnection connection
)

Disconnects everything related to this connection, i.e.: closes response & notification subscription and streams

Implementation

Future<void> disconnect(NwcConnection connection) async {
  if (connection.subscription != null) {
    Logger.log.d("closing nwc subscription $connection....");
    await _requests.closeSubscription(connection.subscription!.requestId);
  }
  Logger.log.d("closing nwc streams $connection....");
  await connection.close();
  _connections.remove(connection);
}