aws-amplify / aws-amplify/amplify-data

Support `ws` for appsync realtime connection

Open
#471 4 comments 0 reactions 0 assignees View on GitHub
feature-request GraphQL
Dominant language
TypeScript
Stars
18
Forks
23
Avg merge
26m
Merged PRs (30d)
1

Description

### 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](https://www.npmjs.com/package/amplify-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://`,

```typescript
// 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

Contributor guide

Open the contributing guide

Research direction

Read packages/api-graphql/src/Providers/AWSAppSyncRealTimeProvider/index.ts around lines 751-754, focusing on how the realtime endpoint is converted into a websocket URL. Check the existing realtime-related tests before making the change. Done means an http:// input uses ws://, while an https:// input continues to use wss:// for appsync-simulator testing.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.