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 this._lockObject.synchronized(() async {
    this.ThrowIfDisposed();

    this.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 this._currentHangingRequest?.Disconnect();
  });
}