We also have experience creating what is known as Async API Gateway APIs which leverage AWS API Gateway REST APIs, but instead of an AWS Lambda function processing the request and following a request/response architecture where the client or frontend application is waiting for the request to process and return.
We will put SQS (Simple Queue Service) or leverage an AWS DynamoDB stream behind our API and immediately respond to the client or frontend application, then our queue or database stream will invoke an AWS Lambda function to process the request and store the result in our database.
The client or frontend application will listen for changes in our AWS DynamoDB table and when that change takes place it will immediately update the users view. By in large, this is a much better experience for the user because they don't have to wait for the request to finish and respond. While the request is processing they can continue using the client or frontend application and see the result of the processed request propagate in real-time without refreshing the browser.
This kind of architecture can be setup with both AWS API Gateway REST APIs and AWS AppSync for GraphQL APIs.
With AWS API Gateway REST APIs you would be leveraging a websockets connection and it typically requires a bit more low-level knowledge to implement.
With AWS AppSync for GraphQL APIs you can set up real-time connections ****by leveraging AWS AppSync Subscriptions which have a nice easy to use abstraction over websockets and requires less low-level knowledge compared to AWS API Gateway REST APIs. You can download our AWS AppSync Subscriptions Pattern with Serverless Framework by following the link.
There is a third way we will talk about here, which leverages AWS IoT MQTT to create real-time connections. MQTT is a pub/sub protocol where as websockets is an open connection which allows for bi-directional communication.We wrote a multi-part series on building a Real-time ReactJS App powered by AWS IoT MQTT, here are links for part one and part two.