@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.

Methods

public abstract String value()The GraphQL operation document, e.g. subscription OnReview($ep: Episode!) { reviewAdded(episode: $ep) { stars } }.
public abstract String operationName() default ""The operation name to send in the subscribe message’s operationName field.

Method details

value

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

operationName

public abstract String operationName() default ""
The operation name to send in the subscribe message’s operationName field. Optional; required only when value() declares more than one operation.