disconnect method

dynamic disconnect(
  1. NwcConnection connection
)

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

Implementation

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.responseStream.close();
  await connection.notificationStream.close();
  _connections.remove(connection);
}