Support `ws` for appsync realtime connection
Is this related to a new or existing framework?
No response
Is this related to a new or existing API?
GraphQL API
Is this related to another service?
No response
Describe the feature you'd like to request
Support ws for realtime endpoint in order to test with appsync-simulator
Describe the solution you'd like
https://github.com/aws-amplify/amplify-js/blob/3629a7b8ec2bb06ddf885ee5ee18296dc93bcffb/packages/api-graphql/src/Providers/AWSAppSyncRealTimeProvider/index.ts#L751-L754
Change to ws if the input endpoint is http://,
// Creating websocket url with required query strings
discoverableEndpoint = discoverableEndpoint
.replace('https://', 'wss://')
.replace('http://', 'ws://');
Describe alternatives you've considered
Using the dangerously_connect_to_http_endpoint_for_testing flag to enable this feature
Additional context
No response
Is this something that you'd be interested in working on?
- [X] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Hello, @dominhhai and thank you for opening this issue. I'll mark this as a feature request at this point and review it with our team internally. If there's further questions or progress, we'll ping you in a new comment!
Hi @dominhhai, could you explain your use case for this feature request a bit more so we can better understand how this might help?
This seems related to Amplify Gen 1's mocking feature which has been replaced by sandbox environments in Amplify Gen 2 so this may not be necessary anymore.
@chrisbonifacio
sandbox environments in Amplify Gen 2
Could you explain more detail about it?
@chrisbonifacio I checked the sandbox env. However, it is not what I wanted.
I want to work with local appsync such as appsync-simulator.
The localhost is run on ws instead of wss. So it is nice if the amplify libs supports this case.