Skip to content
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

GraphQL websocket subscription integration #540

Merged
merged 24 commits into from
Aug 19, 2016
Merged

Conversation

amandajliu
Copy link
Contributor

@amandajliu amandajliu commented Aug 13, 2016

TODO:

  • Update CHANGELOG.md with your change
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@jbaxleyiii
Copy link
Contributor

@amandajliu @stubailo when this is ready, can we publish it as a rc so I can prep the react client to work with it?

@jbaxleyiii
Copy link
Contributor

also, SO excited for this!

@@ -5,6 +5,7 @@ Expect active development and potentially significant breaking changes in the `0
### vNEXT
- Fixed an issue with named fragments in batched queries. [PR #509](https://github.com/apollostack/apollo-client/pull/509) and [Issue #501](https://github.com/apollostack/apollo-client/issues/501).
- Fixed an issue with unused variables in queries after diffing queries against information available in the store. [PR #518](https://github.com/apollostack/apollo-client/pull/518) and [Issue #496](https://github.com/apollostack/apollo-client/issues/496).
- Add code that support GraphQL subscription over websockets. [PR #540](https://github.com/apollostack/apollo-client/pull/540).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. Maybe replace "that" with "to" and subscription with subscriptions.

@helfer
Copy link
Contributor

helfer commented Aug 16, 2016

Awesome work! I think subscriptions are going to be such a great addition to apollo-client. The only thing I'm concerned about is that the tests don't cover enough potential cases yet, but that can be fixed later.

@stubailo Do you know what happened to coveralls in apollo-client? I can't see it in the CI checks any more.

@@ -89,17 +89,21 @@ export function addQueryMerging(networkInterface: NetworkInterface): BatchedNetw
}) as BatchedNetworkInterface;
}

// Here, we are assuming that there is only one operation
function getSingleOperationName(request: Request) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a check here just to make sure there is actually only one operation.

@helfer
Copy link
Contributor

helfer commented Aug 18, 2016

@stubailo this looks good to me. I think I'll just add one check for the assumption that there's only one operation definition. Can you give it a quick look to make sure it fits into apollo client the way it's supposed to (and uses argument variable names that make sense in the context of AC)?

@@ -5,6 +5,7 @@ Expect active development and potentially significant breaking changes in the `0
### vNEXT
- Fixed an issue with named fragments in batched queries. [PR #509](https://github.com/apollostack/apollo-client/pull/509) and [Issue #501](https://github.com/apollostack/apollo-client/issues/501).
- Fixed an issue with unused variables in queries after diffing queries against information available in the store. [PR #518](https://github.com/apollostack/apollo-client/pull/518) and [Issue #496](https://github.com/apollostack/apollo-client/issues/496).
- Add code to support GraphQL subscriptions over websockets. [PR #540](https://github.com/apollostack/apollo-client/pull/540).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"websockets" doesn't belong here.

@helfer helfer merged commit a2a4652 into master Aug 19, 2016
variables: graphQLSubscriptionOptions.variables,
fragments: graphQLSubscriptionOptions.fragments,
handler: (error: Object, result: Object) => {
const reducer = graphQLSubscriptionOptions.updateFunction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be updateQuery, just like fetchMore. Sorry I didn't check on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can change it for 0.4.13. Heads up @jbaxleyiii

@rclai
Copy link

rclai commented Aug 19, 2016

I noticed you have to pass an id to unsubscribe, can you guys make it so that you can just call stop on the subscription object?

@rclai
Copy link

rclai commented Aug 19, 2016

This is exciting though!

@stubailo
Copy link
Contributor

Yeah probably this is what we will want in the future - subscriptions should probably return Observables, the same way query or fetchMore return Promises.

We are trying to get the experimental thing out the door fast and then iterate on the API.

@stubailo stubailo deleted the subscription-integration branch September 20, 2016 03:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants