Open method

Future<void> Open()
Opens this connection so it starts receiving events from the server. This results in a long-standing call to EWS.

Implementation

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

    this.ValidateConnectionState(
        false, "Strings.CannotCallConnectDuringLiveConnection");

    if (this._subscriptions.length == 0) {
      throw new ServiceLocalException("Strings.NoSubscriptionsOnConnection");
    }

    this._currentHangingRequest = new GetStreamingEventsRequest(
        this._session,
        this.HandleServiceResponseObject,
        this._subscriptions.keys,
        this._connectionTimeout);

    this._currentHangingRequest!.OnDisconnect.add(this._OnRequestDisconnect);

    await this._currentHangingRequest!.InternalExecute();
  });
}