-
Notifications
You must be signed in to change notification settings - Fork 131
Have to publish with subscription name in the object #51
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
Comments
Can you post a link to a repo that duplicates this issue? Depending on how you are constructing your schema you may have to attach a custom resolver to the |
the implementation is abit bugy, |
Sure, this is the link to my repo. https://github.com/AnthonyCC/graphQL-Demo The schema is defined in /server/graphQL/schema.js. The data is published to the channel in /server/route/graphQL.js, Thanks for looking into this issue. |
In your example the object you are publishing is nested incorrectly. This example shows the behavior:
|
I had the same issue and fixed it by adding a Subscription resolver to my resolver map In your case this woule be const resolvers = {
Subscription: {
commentAdded: comment => comment,
},
} In the documentation it says:
For me it did not work at all without the resolver. If someone can confirm this I am going submit a PR. |
Yes. @NeoPhi , that is the issue I am having. If I publish the data with Then I won't get the data in the subscriber, I will get
@n1ru4l , adding a subscription resolver does resolve the issue for me. Thanks for sharing your finding. I have two questions
|
@AnthonyCC When I run the code listed above the output is: |
@NeoPhi , If you publish the object with the subscription name nested in the object, then you will get the expected output, which is
You have to nest the object with However, if you publish the data by |
I found this while struggling with something similar - I wanted to use a certain property in the That being said, it's too implicit imo. Maybe it'd be nice to have a |
Finally. Found this issue and the problem that I was trying to solve for more than an hour is gone. None of the tutorials mentioned that you have to nest it inside the |
Please add this to readme! I spent hours... |
Keeping this open because it seems like we could use more documentation on this. |
Uh oh!
There was an error while loading. Please reload this page.
I was following the tutorial in the README file. I noticed if I use
I will get
But if I publish with the subscription name in the object
Then I will get the result as in the README.
Am I missing something from the document?
The text was updated successfully, but these errors were encountered: