Close method

Future<void> Close()
Closes this connection so it stops receiving events from the server. This terminates a long-standing call to EWS.

Implementation

Future<void> Close() async {
  await _lockObject.synchronized(() async {
    ThrowIfDisposed();

    ValidateConnectionState(
      true,
      "Strings.CannotCallDisconnectWithNoLiveConnection",
    );

    // Further down in the stack, this will result in a call to our OnRequestDisconnect event handler,
    // doing the necessary cleanup.
    await _currentHangingRequest?.Disconnect();
  });
}