Closed racerxdl closed 3 years ago
@chris-ramon that's a quick hack to be able to do better subscriptions. There are other PRs about it (like #495 ) but this one is pretty simple and fast to review. I just add a Subscription parameter so the handler can use it and have better code.
Nice job!! Any prediction of when it will be accept/merged?
I'm also interested in this change. Any news?
Instead of using a different subscribe functions we should use a channel to send events and return this channel as resolver return value
Gqlgen and graphql gophers already do this,
I don’t like the approach of this pr, it is not intuitive and difficult to integrate with pubsub libs
Instead of using a different subscribe functions we should use a channel to send events and return this channel as resolver return value
Gqlgen and graphql gophers already do this,
I don’t like the approach of this pr, it is not intuitive and difficult to integrate with pubsub libs
I gave a longer answer in my PR but the short version is that this project follows the reference implementation which has this method https://github.com/graphql/graphql-js/blob/master/src/type/definition.js#L1001 . It it also not difficult to integrate into pubsub libs if you implement the Subscribe handler https://github.com/graphql/graphql-js/blob/master/src/subscription/subscribe.js#L63
ok i think we can close this in favour of #495
I agree @remorses , Closing in favor of https://github.com/graphql-go/graphql/pull/495
I added Subscribe function to Object / Fields Definitions so its easier to make GraphQL Subscription Handlers. I only added the field so it wouldn't break compatibility and if you don't use it, it wont make a difference.
So for example in https://github.com/racerxdl/go-subscription-handler I did:
With that
Subscribe
field in the struct I could do:That should help with #242