graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.87k stars 839 forks source link

Subscription Support #577

Closed yhc44 closed 3 years ago

yhc44 commented 3 years ago

Hey, it is very sad, that this project seems not being actively maintained.

I used it for some days now and sadly there are some things missing (real subscriptions, field names in queries etc.) so im switching to nodejs in my graphql microservice.

rick-meli commented 3 years ago

Hi, @yhc44 Seems I'm going to do the same 👎 . I really wanted my graphql microservice was built in golang. It's so sad.

Fontinalis commented 3 years ago

Hey @yhc44 and @rick-meli ,

I share your thoughts.. A while back, this was part of the reasons why I started developing a GraphQL package in Go, with a similar, but different approaches. Since then, the core implementation got into a stable phase, and the additional features are still in development, but at my company we are confident enough to use it in projects that are we are currently working on.

It has Subscriptions, Apollo Federation, field directives support, and many more features are coming, since I’m pumped to get them implemented, and personally we’ll also need them at work. So if you are still in the decision making, I would encourage you to check out the repo, see the examples, try it, check if it meet you needs and ask me any questions if you have.

rigglo/gql

giautm commented 3 years ago

Can you give a try will gqlgen? They generate go code from GraphQL schema, in-active development and subscription supported.

chris-ramon commented 3 years ago

Hi @yhc44! –– Thanks for giving a try to the lib and sharing your thoughts:


Hey, it is very sad, that this project seems not being actively maintained.

Actually we do try our best to actively maintain it, this is a concern that was raised in a previous issue: Going out of life? and as pointed out in that issue hopefully we can catch-up on the awesome PRs that are to be reviewed & merge:

We have many awesome contributors that were improving the library along the way, hopefully we can catch-up closing more issues and merging PRs. Ref: https://github.com/graphql-go/graphql/issues/527#issuecomment-581579779


I used it for some days now and sadly there are some things missing (real subscriptions, field names in queries etc.)

real subscriptions:

If you mean with real subscriptions having support for the subscribe property at the field definition level, yes this is a feature that hopefully we will be integrating soon via the PR#495.

But we do have Subscriptions support at the schema level since quite long time ago:

https://github.com/graphql-go/graphql/blob/2b0b7340d2285b861482047fbf5de0488e021bea/schema.go#L10

And here is a small working example: https://github.com/graphql-go/graphql/issues/49#issuecomment-404909227


field names in queries

If with field name in queries your referring to aliases, we do have alias support on queries:

1

etc.

If you could expand on this would be cool.

so im switching to nodejs in my graphql microservice.

That would be a good alternative since graphql-js have the latest GraphQL Spec features because the nature of being the reference implementation.

yhc44 commented 3 years ago

Hey @chris-ramon, thanks for your detailed answer.

With field names i mean for example

subscription {
  onCreateCluster {
    id
  }
}

I implemented your pubsub example, which is working fine. But how can i retrieve the field id in this example? I dont want to return all fields that i have on the specific object.

I just want to return

{
  id: '1337'
}

not

{
  id: '1337',
  ...allOtherFields (e.g name)
}

Sorry for my initial title btw. Was not very specific.

gerarts commented 3 years ago

Hey @chris-ramon, do you already have an ETA for PR #495? The last real commit to that PR was almost a year ago and as far as I can tell everything seems to work as intended (also see @bhoriuchi's comment from November). Are we still waiting for something else? Thanks!

chris-ramon commented 3 years ago

Subscription Support Resolved via: https://github.com/graphql-go/graphql/pull/495 — @yhc44 feel free to file a new issue if is the case in regards your question above: https://github.com/graphql-go/graphql/issues/577#issuecomment-721021778 ( You should be receiving as part of the response only the fields that your query/subscription includes. )