AWS App Sync Subscriptions are not working

Viewed 1605

I am using AppSync to update my DynamoDB.

I have subscribed to that particular row, updated based on the partition key but I'm not able to receive the notifications.

I was expecting the output something like below mentioned

{ "data": { "Post": null } }

But, I'm getting output as

     { "mqttConnections": 
       [ { "url": "*****",
           "topics": ["*******************************","*****************************"],
           "client": "*************" 
       } ], 
       "newSubscriptions": 
          { "UpdateDevTable": 
            { "topic": "*****************************", 
              "expireTime": 1541598037000 }  
            } 
          }

Can someone look into this and help me out?

1 Answers

This is functioning as expected. Subscriptions in AWS AppSync run on MQTT over WebSockets and the actual subscription request in GraphQL is responsible for creating an MQTT topic and configuring a credential so your client can connect to the topic. The AppSync SDKs handle connecting to the topic and streaming results into your application but you can also build your own subscription client using any MQTT client such as paho (https://www.eclipse.org/paho/).

You can learn more about how to use subscriptions from JavaScript by searching for "Make Your Application RealTime" here https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html

Related