subscribe<T> method

Stream<GraphQLResponse<T>> subscribe<T>(
  1. GraphQLRequest<T> request, {
  2. void onEstablished()?,
})

Subscribes to the given request and returns the stream of response events. An optional onEstablished callback can be used to be alerted when the subscription has been successfully established with the server.

Any exceptions encountered during the subscription are added as errors to this stream.

Implementation

Stream<GraphQLResponse<T>> subscribe<T>(
  GraphQLRequest<T> request, {
  void Function()? onEstablished,
}) =>
    identifyCall(
      ApiCategoryMethod.subscribe,
      () => defaultPlugin.subscribe(
        request,
        onEstablished: onEstablished,
      ),
    );