apollographql / apollographql/graphql-subscriptions

Subscribe returns a Promise<number>, but sometimes we want to cancel a subscription

Open
#177 1 comment 1 reaction 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.