documentationgood first issuehelp wanted
Repository metrics
- Stars
- (2,609 stars)
- PR merge metrics
- (PR metrics pending)
Description
I want to implement my own subscription manager. I can't use the plugin because I need a different API. How do I know if a subscription was ended / lost?
I need something like this:
builder.subscriptionField('station', (t) =>
t.field({
args: {
where: t.arg({
type: "StationWhereInput"
})
},
type: 'StationSubscriptionPayload',
subscribe: (_parent: any, args: any, context: any, { fieldName }: ResolveShape) => {
const channel = uid()
SUBSCRIPTIONS[channel] = { ...args, channelName: fieldName }
return pubsub.subscribe(channel)
},
unsubscribe: ???,
resolve: async ({ node, mutation }) => {
return {
mutation,
node
}
}
})
)
I need to track active Subscriptions and want to know when someone stopped a subscription. (remove it from my SUBSCRIPTIONS object).
Or if this is not possible, is there something like apollo's withFilter? That would be even cooler. https://www.apollographql.com/docs/apollo-server/data/subscriptions/#filtering-events