-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation-independent type of the query field in the subscribe message #44
Comments
As far as I understand the E.g. in graphql-js you have the |
Hey, I am glad you found the Protocol helpful! Would be awesome to see an implementation in Java. As mentioned in the comment before, the Protocol does indeed allow a Nevertheless, the query GraphQL Document type is meant to describe a complete file or request string operated on by a GraphQL service or client. |
Well, if we decide to use this protocol in public API, we have to support both types because it's up to a client to choose which type it will use. And yes, it's probably possible to parse the whole JS AST from JSON and transforms it into Java AST representation, but in that case, we have to fork GraphQL java as there is no public API that expects query AST as input (or find some way how to safely use internal API or serialize it as a query string on the server-side which is a really bad solution). So, it's cheaper for us to implement yet another Websockets subprotocol than to maintain a fork of the Java GraphQL ecosystem. Anyway, thanks for the clarification on why the protocol use Thanks again. |
The client should be able to decide between the two types. Some like sending the Actually, I haven't done any benchmarks, yet. I do indeed prefer the string query as it reads much nicer and will often be much smaller in size (compared to a serialised Furthermore, as this Protocol is aiming to be a part of the GraphQL standard, you're insights would be very welcome at the GraphQL over WebSocket PR in the official GraphQL over HTTP Proposal spec. Would be great to discuss more about the |
Are sure about the Apollo client? It seems to me that it sends the
I will check the link. It sounds interesting, thanks for pointing it out. |
It sure does, but only for HTTP though. Check out the WebSocket link implementation. Thinking about it further, I must say that changing the |
I know. It's up to a link implementation. And yes, I pointed HTTP link, because the only official (ok, semi-official, Apollo crew don't want to maintain it) WebSocket link implementation, I'm aware of, is the subscriptions-transport-ws which still use the Please let me know how you decided, I'm really looking forward to it. |
I have made #45, but I am still not completely on board... There are some pros and cons in the description there. Would be cool if you could make this argument at the GraphQL over WebSocket PR. Hearing more opinions would be a smart move when faced with making a decision like this. |
Thank you for the really quick implementation and feedback to my question. I made a comment to the PR, so let see what the others think about it. |
Unless the AST is not part of the GraphQL spec the |
🎉 This issue has been resolved in version 1.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hello,
we have been looking for an alternative protocol to subscriptions-transport-ws and found this repository which looks very promising and far more mature.
The only problem is the query type in the
subscribe
message that seems to be javascript specific as theDocumentNode
is part of internal classes of graphql-js, and our server is written in Java. Do you plan to make the protocol more open for other languages that use only thestring
query representation of GQL query in GQL library public API?The text was updated successfully, but these errors were encountered: