Can I use ApolloClient to subscribe with Appsync graphql?

Viewed 629

I am reading Appsync articles about how to use subscription and come up with this link: https://docs.aws.amazon.com/appsync/latest/devguide/real-time-data.html. It says The AWS AppSync client SDK automatically handles subscription connection management.

My question is whether I can use graphql libraries other than AppSync client SDK? If I can, how are the subscription connections handled? Is there any problem to use other clients?

1 Answers

If you use the REALTIME endpoint on your API (recommended), depending on your platform then you can use either the AppSync SDK or the Amplify client, it will work out of the box. https://aws.amazon.com/blogs/mobile/appsync-realtime/

Technically, you are free to use any client that supports websockets but you will need to implement the handshake & subscription flow. (it's very close to the Apollo flow with minor changes to improve security)

We created a client for Python that showcases it is possible if you want to use a different client or language when using AppSync https://aws.amazon.com/blogs/mobile/appsync-websockets-python/.

Related