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

Add client awareness support #4154

Merged
merged 14 commits into from
Nov 21, 2018
Merged

Add client awareness support #4154

merged 14 commits into from
Nov 21, 2018

Conversation

hwillson
Copy link
Member

@hwillson hwillson commented Nov 19, 2018

This PR updates the ApolloClient constructor to accept name and version params, that can be used to support Apollo Server Client Awareness functionality. These client awareness properties are passed into the defined Apollo Link chain, and are then ultimately sent out as custom headers with outgoing requests.

Associated Apollo Link PR: apollographql/apollo-link#872

To assist with Engine's client awareness features, these changes
allow `name` and `version` params to be passed into the
`ApolloClient` constructor. These properties are then passed
along via the defined `Link` chain, within the operation
`context` made available to each `Link`. Any `Link` interested
in using these values can pull them from the
`context.clientAwareness` object.
@hwillson hwillson requested review from evans and removed request for evans November 19, 2018 17:53
Copy link

@zionts zionts left a comment

Choose a reason for hiding this comment

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

Added notes on docs. There's a test for the logic and it seems like it works, but I'm not knowledgable enough about the surrounding context to give this a 👍

packages/apollo-client/src/ApolloClient.ts Show resolved Hide resolved
packages/apollo-client/src/ApolloClient.ts Outdated Show resolved Hide resolved
packages/apollo-client/src/ApolloClient.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@evans evans left a comment

Choose a reason for hiding this comment

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

Super awesome @hwillson! Thank you for putting this together. I left a couple of suggestions on the documentation in case that makes things a bit more clear. I wasn't quite sure what it meant to represent connections and felt we could be a bit more specific about the mechanics of name and version

❤️ the testing

docs/source/api/apollo-client.md Outdated Show resolved Hide resolved
docs/source/api/apollo-client.md Outdated Show resolved Hide resolved
packages/apollo-client/src/ApolloClient.ts Outdated Show resolved Hide resolved
packages/apollo-client/src/ApolloClient.ts Outdated Show resolved Hide resolved
@hwillson hwillson merged commit 453e948 into master Nov 21, 2018
@hwillson hwillson deleted the hwillson/add-client-headers branch November 21, 2018 01:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 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.

None yet

3 participants