apollographql / apollographql/graphql-subscriptions
Trigger a function on unsuscribe
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to trigger a function on when the client unsubscribes to a specific subscription
Something like this, but I know this doesn't work
` HomesSubscription: {
subscribe: (rootValue: any, args: any, context: any) => {
startHomeSub(context.token,context.env)
return pubsub.asyncIterator('Homes_Changed')
},
unsubscribe: () => {
stopHomeSub()
},
},`
Contributor guide
Research direction
The issue does not identify a file, test, or implementation entry point. First clarify the expected unsubscribe lifecycle and scope, then locate the subscription handling code and add a focused test showing that the requested callback runs when a client unsubscribes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100