StreamingSubscriptionConnection constructor

StreamingSubscriptionConnection(
  1. ExchangeService service,
  2. int lifetime
)
Represents a delegate that is invoked when notifications are received from the server The StreamingSubscriptionConnection instance that received the events. The event data. Represents a delegate that is invoked when an error occurs within a streaming subscription connection. The StreamingSubscriptionConnection instance within which the error occurred. The event data. Occurs when notifications are received from the server. Occurs when a subscription encounters an error. Occurs when a streaming subscription connection is disconnected from the server. Initializes a new instance of the The ExchangeService instance this connection uses to connect to the server. The maximum time, in minutes, the connection will remain open. Lifetime must be between 1 and 30.

Implementation

// delegate void NotificationEventDelegate(object sender, NotificationEventArgs args);

/// <summary>
/// Represents a delegate that is invoked when an error occurs within a streaming subscription connection.
/// </summary>
/// <param name="sender">The StreamingSubscriptionConnection instance within which the error occurred.</param>
/// <param name="args">The event data.</param>
// delegate void SubscriptionErrorDelegate(object sender, SubscriptionErrorEventArgs args);

/// <summary>
/// Occurs when notifications are received from the server.
/// </summary>
// event NotificationEventDelegate OnNotificationEvent;

/// <summary>
/// Occurs when a subscription encounters an error.
/// </summary>
// event SubscriptionErrorDelegate OnSubscriptionError;

/// <summary>
/// Occurs when a streaming subscription connection is disconnected from the server.
/// </summary>
// event SubscriptionErrorDelegate OnDisconnect;

/// <summary>
/// Initializes a new instance of the <see cref="StreamingSubscriptionConnection"/> class.
/// </summary>
/// <param name="service">The ExchangeService instance this connection uses to connect to the server.</param>
/// <param name="lifetime">The maximum time, in minutes, the connection will remain open. Lifetime must be between 1 and 30.</param>
StreamingSubscriptionConnection(ExchangeService service, int lifetime) {
  EwsUtilities.ValidateParam(service, "service");

  EwsUtilities.ValidateClassVersion(
      service, ExchangeVersion.Exchange2010_SP1, this.runtimeType.toString());

  if (lifetime < 1 || lifetime > 30) {
    throw new RangeError.range(lifetime, 1, 30, "lifetime");
  }

  this._session = service;
  this._subscriptions = new Map<String?, StreamingSubscription>();
  this._connectionTimeout = lifetime;
}