Looking for reactive Apollo controllers? See @apollo-elements/core
ApolloSubscription inherits from ApolloElement and implements the ApolloSubscriptionInterface.
Read the subscription component guides for examples and tips.
ApolloSubscription
🚀 LitElement base class that updates with an Apollo GraphQL subscription.
See ApolloSubscriptionInterface for more information on events
Properties
is
static(read-only)stringcontroller
ApolloController<D, V>canAutoSubscribe
(read-only)booleansubscription
ComponentDocument<D, V> | nullnoAutoSubscribe
booleansubscribenotifyOnNetworkStatusChange
boolean | undefinedshouldResubscribe
booleanskip
booleanerrorPolicy
C.ErrorPolicy | undefinedfetchPolicy
C.FetchPolicy | undefinedpollInterval
number | undefinedreadyToReceiveDocument
booleanclient
ApolloClient<NormalizedCacheObject> | nulldocument
ComponentDocument<D, V> | nullDocumentNodecontext
Record<string, unknown> | undefinedloading
booleandata
Data<D> | nullvariables
Variables<D, V> | nullerror
Error | ApolloError | nullerrors
readonly GraphQLError[]Methods
subscribe
Resets the observable and subscribes.Parameters
args
Parameters<this['controller']['subscribe']>Returns
voidcancel
Cancels and clears the subscriptionReturns
voidshouldSubscribe
Determines whether the element should attempt to subscribe automatically Override to prevent subscribing unless your conditions are metParameters
options
Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>Returns
booleanonSubscriptionData
Callback for when data is updatedParameters
result
OnSubscriptionDataParams<Data<D>>Returns
voidonError
Callback for when error is updatedParameters
error
C.ApolloErrorReturns
voidonSubscriptionComplete
Callback for when subscription completes.Returns
voidEvents
apollo-element-connected
ApolloElementEventapollo-element-disconnected
ApolloElementEventExports
js ApolloSubscription from apollo-subscription.js