apollographql / apollographql/graphql-subscriptions

Have to publish with subscription name in the object

Open
#51 12 comments 8 reactions 0 assignees View on GitHub
documentation good first issue help wanted
Dominant language
TypeScript
Stars
1.6k
Forks
129
PR merge metrics
No merged PRs in 30d

Description

I was following the tutorial in the README file. I noticed if I use
```
// publish to the channel
pubsub.publish('newCommentsChannel', {
id: 123,
content: 'Test',
repoFullName: 'apollostack/GitHunt-API',
posted_by: 'helfer',
});
```

I will get
```
{
data: {
commentAdded: null
}
}
```
But if I publish with the subscription name in the object
```
// publish to the channel
pubsub.publish('newCommentsChannel', {
commentAdded: {
id: 123,
content: 'Test',
repoFullName: 'apollostack/GitHunt-API',
posted_by: 'helfer',
}
});
```

Then I will get the result as in the README.
Am I missing something from the document?

Contributor guide

Open the contributing guide

Research direction

Start with the README's subscription publishing tutorial and compare its pubsub.publish example with the reported result. Check how the channel payload is mapped to the subscription field; done when the README clearly explains whether commentAdded is required and the example matches the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, node.js, typescript
Domain
api, backend-api-design, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.