Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appsync subscription with arguments

We are having huge troubles with subscriptions with arguments

to simplify the problem Here are the steps to reproduce

create a simpleSchema

type Mutation {
    testSubMutation(param: String!): String
}

type Query {
    testQuery: String
}

type Subscription {
    testSubs(param: String): String
        @aws_subscribe(mutations: ["testSubMutation"])
}

I attached a local resolver to the mutation which returns the timestamp.

in one window open the app sync query tab and make the subscription

subscription sub{
  testSubs
}

in the other window make a mutation

mutation mut{
  testSubMutation(param:"123")
}

works like a charm

now change the subscription to listen to a parameter

subscription sub{
  testSubs(param:"123")
}

Does not work any more. :(

Any help is appreciated.

like image 621
Gaurav Lanjekar Avatar asked Jul 30 '18 21:07

Gaurav Lanjekar


1 Answers

Subscriptions require the parameter you're filtering on to be in the response of the mutation. Could you try updating your mutation to this?

mutation mut{
  testSubMutation(param:"123") {
    param
  }
}
like image 124
Jeff Bailey Avatar answered Sep 18 '22 09:09

Jeff Bailey