subscribe method

Stream<QueryResult<Object?>> subscribe(
  1. SubscriptionOptions<Object?> options, {
  2. FutureOr<Version?> ver()?,
  3. bool resubscribe = true,
  4. int priority = 0,
})

Subscribes to a GraphQL subscription according to the options specified.

The higher the priority, the earlier this subscription will be subscribed to in a rate limiter queue.

Implementation

Stream<QueryResult> subscribe(
  SubscriptionOptions options, {
  FutureOr<Version?> Function()? ver,
  bool resubscribe = true,
  int priority = 0,
}) {
  return SubscriptionHandle(
    _subscribe,
    (e) {
      _subscriptions.remove(e);
      e?.dispose();
    },
    options,
    ver: ver,
    resubscribe: resubscribe,
    priority: priority,
  ).stream;
}