Search code examples
typescriptaws-amplifyaws-appsync

How to configure Aws Amplify for a AppSync subscription Websocket endpoint?


How do I specify a websocket endpoint using Amplify.configure(awsConfig) The docs only demonstrate how to do a singular http endpoint using the aws_appsync_graphqlEndpoint

AWS Amplify.configure docs.

I have separate appsync urls one is a "realtime" websocket url.

REACT_APP_GRAPHQL_ENDPOINT_HTTP
REACT_APP_GRAPHQL_ENDPOINT_WS

I am trying to connect to AppSync with the AWS Amplify SDK using the Amplify graphql subscriptions


Solution

  • I discovered that aws-amplify will automatically configure the websocket endpoint based on the http endpoint when you use Amplify.configure(awsConfig). Did not see this mentioned any where and is a bit magical.