I am using AWS AppSync for my project. it is working fine when data is being pushed to the server using mutation. but i am having problem with subscription.
OnEventCreated onEventCreated = OnEventCreated.builder().build();
subscriptionWatcher = ClientFactory.getInstance(this).subscribe(onEventCreated); // giving error
subscribe
function takes input which implements Subscription.
but when i build my project, the generated code implements Query.
Generated Class
@Generated("Apollo GraphQL")
public final class OnEventCreated implements Query<OnEventCreated.Data, OnEventCreated.Data, Operation.Variables> {
public static final String OPERATION_DEFINITION = "subscription OnEventCreated {\n"
+ " onEventCreated {\n"
+ " __typename\n"
+ " id\n"
+ " description\n"
+ " name\n"
+ " when\n"
+ " where\n"
+ " }\n"
+ "}";
public static final String QUERY_DOCUMENT = OPERATION_DEFINITION;
}...
specific code for subscription in GraphQL file is ..
subscription OnEventCreated {
onEventCreated {
id
description
name
when
where
}
} ...
Schema.json file
type Subscription {
subscribeToEventComments(eventId: String!): Comment
@aws_subscribe(mutations: ["commentOnEvent"])
onEventCreated: Event
@aws_subscribe(mutations: ["createEvent"])
}...
Build files contains...
compile 'com.amazonaws:aws-android-sdk-appsync:2.6.16'
compile 'com.amazonaws:aws-android-sdk-appsync-compiler:2.6.16'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.6.16'
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'
compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
what can i do for it. when i build, the generated OnEventCreated class implements Subscription interface instead of Query interface