apollographql / graphql-subscriptions

:newspaper: A small module that implements GraphQL subscriptions for Node.js
MIT License
1.59k stars 133 forks source link

Trigger a function on unsuscribe #181

Open ubbop42 opened 5 years ago

ubbop42 commented 5 years ago

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() }, },

grantwwu commented 5 years ago

Have you looked at https://github.com/apollographql/graphql-subscriptions/issues/141 ?