unsubscribe method

Future<void> unsubscribe(
  1. Subscription sub
)

Operation method that removes a Subscription that is currently in the "active" state.

By bringing back a Subscription to the "inactive" state, the unsubscription from all its items is requested to Lightstreamer Server.

Lifecycle Subscription can be unsubscribed from at any time. Once done the Subscription immediately exits the "active" state.
Note that forwarding of the unsubscription to the server is made in a separate thread.
The unsubscription will be notified through a SubscriptionListener.onUnsubscription event.

  • sub An "active" Subscription object that was activated by this LightstreamerClient instance.

⚠ WARNING ⚠ The completion of the returned Future indicates that the operation has been accepted and is in progress, but not necessarily completed. To receive notifications about events generated by the operation, it is necessary to register a SubscriptionListener.

Implementation

Future<void> unsubscribe(Subscription sub) async {
  var arguments = <String, dynamic>{
    'subId': sub._id
  };
  sub._active = false;
  sub._subscribed = false;
  sub._commandPosition = null;
  sub._keyPosition = null;
  return await NativeBridge.instance.client_unsubscribe(_id, sub._id, arguments);
}