aws-amplify / aws-amplify/amplify-data
Add support for `/graphql/realtime` url for Mock
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 23
- Avg merge
- 26m
- Merged PRs (30d)
- 1
Description
### Is this related to a new or existing framework?
New framework
### 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
Amplify JS has special handling for Websocket subscription. when the AppSync API is using custom domain. Please add support for the same when using mock. When running mock server a special variable `aws_appsync_dangerously_connect_to_http_endpoint_for_testing` is set to allow to connect using unsecure websocket.
https://github.com/aws-amplify/amplify-js/blob/bb60060d30c7463d1893b7678ebc18e959b46990/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts#L144-L148
https://github.com/aws-amplify/amplify-js/blob/bb60060d30c7463d1893b7678ebc18e959b46990/packages/pubsub/src/Providers/AWSAppSyncRealTimeProvider.ts#L170-L172
CLI has a bug report(aws-amplify/amplify-category-api#122) to add support to `/graphql/realtime` endpoint and we would like feature parity in the libraries as well
### Describe the solution you'd like
When `aws_appsync_dangerously_connect_to_http_endpoint_for_testing` is set, add `/realtime` to the websocket url
### Describe alternatives you've considered
Keeping the mock subscription server in `/grpahql` but it would degrade the DX
### Additional context
_No response_
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Read the referenced AWSAppSyncRealTimeProvider.ts sections at lines 144-148 and 170-172 to understand the expected custom-domain behavior. Then locate the mock server's WebSocket URL construction and related subscription tests. Done means mock subscriptions use the requested /graphql/realtime endpoint when the testing connection variable is set, while existing behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100