apollographql / apollographql/graphql-subscriptions
Subscribe returns a Promise<number>, but sometimes we want to cancel a subscription
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
I guess this is related to promise cancellation..?
https://github.com/apollographql/graphql-subscriptions/blob/master/src/pubsub-engine.ts#L3
` subscribe(triggerName: string, onMessage: Function, options: Object): Promise`
is problematic because we may want the connection ID (I assume that's what the number is for?) before we connect, in order to say, close it.
Contributor guide
Research direction
Start with src/pubsub-engine.ts, especially the subscribe signature linked in the issue. Investigate how the returned Promise and numeric connection ID are used, then define a cancellation API that makes the ID available at the needed time. Done means the subscription can be closed reliably without relying on an unresolved Promise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100