- Newest
- Most votes
- Most comments
Yes, the aws-appsync-subscription-link package does contain WebSocket functionality for GraphQL subscriptions in AWS AppSync. However, you do not need to explicitly install graphql-ws separately.
AWS AppSync has transitioned to using pure WebSockets for GraphQL subscriptions, moving away from the older MQTT over WebSockets protocol. The aws-appsync-subscription-link package, which is part of the AWS AppSync SDK for JavaScript, automatically handles the WebSocket connection for you.
If you're using a recent version of the AWS AppSync SDK (version 3.0.2 or later) or Amplify clients (version 2.1.0 or later), these libraries automatically use pure WebSockets for subscriptions by default. This means you don't need to install any additional WebSocket-specific packages like graphql-ws.
The AWS AppSync SDK takes care of establishing and maintaining the secure WebSocket connection, handling the subscription workflow, and managing the communication between your client and the AppSync service. This includes tasks such as connection initialization, subscription registration, receiving subscription events, and maintaining the connection with keep-alive messages.
By using aws-appsync-subscription-link, you're already set up to use WebSockets for your GraphQL subscriptions in AWS AppSync without any additional installations or configurations.
Additionally, you can go through the below example provided for using subscription with the aws-appsync-subscription-link package :
Sources
AWS AppSync adds Real-Time enhancements with Pure WebSockets support for GraphQL Subscriptions
Building a real-time WebSocket client in AWS AppSync - AWS AppSync
Relevant content
- asked 6 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 2 months ago
