apollographql / graphql-subscriptions

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

Allow withFilter asyncIteratorFn to return Promise #196

Closed janhalama closed 5 years ago

janhalama commented 5 years ago

Use case: asyncIteratorFn is place where I want to authorize the subscription, authorization should not be implemented in GraphQL resolvers, I want to delegate authorization logic to the business layer which is in our case implemented in another service, that is why I need to change result of ResolverFn to Promise<AsyncIterator<any>> to be able to await for the result of the service call in asyncIteratorFn handler

apollo-cla commented 5 years ago

@janhalama: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

janhalama commented 5 years ago

I found out that withFilter asyncInteratorFn is not the right place for subscription authorization and used resolve handler instead.