close method

Future<void> close()

cancels stream subscription and closes relay transport

Implementation

Future<void> close() async {
  if (_streamSubscription != null) {
    await _streamSubscription!.cancel();
  }
  if (relayTransport != null) {
    await relayTransport!.close().timeout(const Duration(seconds: 3),
        onTimeout: () {
      Logger.log.w("timeout while trying to close socket $url");
    });
  }
}