GraphQLSubscriptionOperation
open class GraphQLSubscriptionOperation<R: Decodable>: AmplifyInProcessReportingOperation<
GraphQLOperationRequest<R>,
GraphQLSubscriptionEvent<R>,
Void,
APIError
>, @unchecked Sendable
GraphQL Subscription Operation
-
Publishes the state of the GraphQL subscription’s underlying network connection.
Subscription termination will be reported as a
completionon thesubscriptionDataPublishercompletion, so this is really only useful if you want to monitor the.connectedstate.Declaration
Swift
var connectionStatePublisher: AnyPublisher<SubscriptionConnectionState, APIError> { get } -
Publishes the data received from a GraphQL subscription.
The publisher emits
GraphQLResponseevents, which are standard SwiftResultvalues that contain either a successfully decoded response value, or aGraphQLResponseErrordescribing the reason that a value could not be successfully decoded. Receiving a.failureresponse does not mean the subscription is terminated–the subscription may still receive values, and each value is independently evaluated. Thus, you may see a data stream containing a mix of successfully decoded responses, partially decoded responses, or decoding errors, none of which affect the state of the underlying subscription connection.When the subscription terminates with a cancellation or disconnection, this publisher will receive a
completion.Declaration
Swift
var subscriptionDataPublisher: AnyPublisher<GraphQLResponse<R>, Failure> { get }
View on GitHub