Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulating Subscriptions #23

Open
Mudassir-23 opened this issue May 14, 2020 · 8 comments
Open

Simulating Subscriptions #23

Mudassir-23 opened this issue May 14, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@Mudassir-23
Copy link

@bboure I really appreciate your efforts in contributing to serverless-appsync-plugin and creating this awesome serverless-appsync-simulator plugin.

I'm facing problem testing subscriptions, I'm assuming subscription endpoint is ws://${IP_ADRESS}:20003/graphql

when I subscribe, a message "listening" continues to show up but on mutation, nothing would happen with a subscription(no data is received).

I'm using graphql explorer to test subscription.

@bboure
Copy link
Member

bboure commented May 14, 2020

Hi @Mudassir-23
To be honest, I have not used the subscription feature yet.

I will try to find some time to test and see if there are issues.

In any case, the problem is possibly in https://github.com/aws-amplify/amplify-cli
since, this plugin is only a wrapper of it.

If you have some time and want to help, you can also try to debug and try to find the source of the problem

@ElvenMonky
Copy link

ElvenMonky commented Nov 6, 2020

Historically AppSync was using MQTT not WebSocket to deliver subscriptions.
That said support of WebSockets as a transport protocol was added quite recently:
https://aws.amazon.com/about-aws/whats-new/2020/04/aws-appsync-enables-support-for-generic-websockets-clients-graphql-real-time-subscriptions/
There might be already some support for subscriptions in Amplify CLI, e.g. I see issue opened just today: aws-amplify/amplify-cli#5798

Let's see if I can find some time and figure out what contribution needs to be done here.

@bboure bboure added the enhancement New feature or request label Apr 8, 2021
@skix123
Copy link

skix123 commented Apr 8, 2021

Hi, any planned updates in implementing subscriptions?

@Mudassir-23
Copy link
Author

@bboure Subscription with serverless-appsync-simulator work fine, its just that graphiql interface doesn't support the subscription testing yet.
I was able to test subscription in dev through this example https://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/aws-appsync%403.0.4/tutorials/react-offline-realtime-todos/src/App.js. I'm planning to clean up this example to make it generic and easy to understand, will post the link here soon.
Again, I really appreciate your efforts in developing this plugin.

@ehtesham1996
Copy link

Hi @Mudassir-23 ,
Any way possible you can post more easier example here ?

@adamduren
Copy link

It seems GraphiQL has supported subscriptions with a custom fetcher for some time now according to this blog post.

@Hideman85
Copy link

There is an update in the amplify project According to the CHANGELOG they have fixed mocking WS.

Note this changes are available in the latest version but for this we need to swicth from amplify-appsync-simulator to @aws-amplify/amplify-appsync-simulator

We tried today in our team via yarn resolutions "amplify-appsync-simulator": "npm:@aws-amplify/amplify-appsync-simulator@^2.6.1" and with a postinstall patch in ./node_modules/amplify-appsync-simulator/lib/data-loader/index.js

// Disabled since causing conflict somehow
//addDataLoader("AMAZON_ELASTICSEARCH"

This looks working fine, would love to see an update on this 😉

@bboure
Copy link
Member

bboure commented Oct 13, 2022

Thank you @Hideman85

If you got this working, please feel free to open a PR, that would be great.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants