Annotation Type Subscription


@Retention(CLASS) @Target(METHOD) public @interface Subscription
Declares a GraphQLClient method as a GraphQL subscription, streamed over a WebSocket using the graphql-transport-ws protocol. The value() is the operation document and Var-annotated parameters supply its $variables. The method takes a trailing GraphQLSubscription.Handler<T> and returns a GraphQLSubscription handle whose cancel() ends the stream.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The GraphQL operation document, e.g.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The operation name to send in the subscribe message's operationName field.
  • Element Details

    • value

      String value
      The GraphQL operation document, e.g. subscription OnReview($ep: Episode!) { reviewAdded(episode: $ep) { stars } }.
    • operationName

      String operationName
      The operation name to send in the subscribe message's operationName field. Optional; required only when value() declares more than one operation.
      Default:
      ""