This aims to solve the problem with having subscriptions enabled in GraphQL and serverless. As you are aware, the lambdas are short-lived, which means that a socket connection with it cannot be maintained. This shows how aws-lambda-graphql circumvents this issue by using Dynamo to maintain the WS connections.
First, make sure to npm install all the deps in both app and bff.
- Deploy the BFF stack using serverless
- Copy over the SLS output urls for HTTP and WS to app/src/index.js (lines 14 & 21)
- Run the client app locally (created with CRA)
- Run bff/dynamo-seed.js
- Your client app will be notified about new data, through WS GQL subscriptions.