AWS AppSync adds Real-Time enhancements with Pure WebSockets support for GraphQL Subscriptions

Posted on: Nov 15, 2019

AWS AppSync is a managed GraphQL service that simplifies application development by letting you create a flexible API to securely access, manipulate, and combine data from one or more data sources. AppSync allows you to easily make any of its supported data sources real time, with connection management handled automatically between the client and the service. With today’s launch we’re releasing enhancements to AppSync that will further optimize access to applications requiring real-time updates, such as gaming leaderboards, social media apps, sports scores, live streaming, interactive chatrooms, IoT dashboards, and many others, by enabling a new protocol option with support to metrics and larger payloads.

In addition to MQTT over WebSockets, applications can now take advantage of pure WebSockets as a new protocol option to communicate in real-time with connected clients. The new protocol supports a higher maximum payload size (240kb vs. 128kb), enhanced connection and broadcast rates, CloudWatch metrics, and selection set filtering for GraphQL subscriptions. Starting today, both new and existing AppSync APIs support the pure WebSockets protocol. While MQTT over WebSockets is also available, the new protocol is our recommended option moving forward and supports the new features. The new protocol, in conjunction with intelligent libraries for iOS, Android, and JavaScript (web and React Native), handles client connections, scalability, fan-out, and broadcasting. This enables developers to focus on the business differentiators for their real-time applications instead of WebSockets operations and infrastructure management.

To take advantage of all the new features, clients need to upgrade to the latest AppSync SDK for JavaScript and iOS (version 3.0.2+) and Amplify clients (version 2.1.0+) rolling out today, with the AppSync SDK for Android rolling out in the next week. The new client versions will connect automatically using pure WebSockets by default. Existing clients won’t be affected and will keep using GraphQL subscriptions via MQTT over WebSockets as before. Both existing and new clients will be able to send and receive data using GraphQL subscriptions and communicate with each other in the same API independently of the protocol; no action is required from the developer perspective and no code changes are necessary as existing clients won’t be affected.

For more details on the new real-time features, refer to our blog post and the AppSync documentation.