Proposed API:
const client = new ApolloClient({
uri: 'https://nx9zvp49q7.lp.gql.zone/graphql',
subscriptionsUri: 'https://nx9zvp49q7.lp.gql.zone/subs',
})
yes please!
Here's another proposed API:
const client = new ApolloClient({
ws: new WebSocketLink({
uri: 'ws://...',
options: {
reconnect: true
}
})
})
This way configs for WebSocketLink
are handled outside of apollo-boost and no more dependencies are needed, when doing SSR (or using something like Next.js) the above will fail cause WebSocketLink will throw an error, so it may also take a function that returns the link and is only called client side
const client = new ApolloClient({
ws: () => new WebSocketLink({ ... })
})
I will be happy to do a PR, it's ready 馃拑
waiting updates ......
@nimerfarahty I have the PR ready since a long time ago, I'm not yet making a PR because of this
Feature requests will be labeled as such, and we encourage using GitHub issues as a place to discuss new features and possible implementation designs. Please refrain from submitting a pull request to implement a proposed feature until there is consensus that it should be included. This way, you can avoid putting in work that can鈥檛 be merged in.
I like my approach because the subscriptions may be innecesary for some people so more dependencies makes no sense for those cases, also it'll be possible to use any option available for WebSocketLink
, but the first approach proposed is more straigthforward so I'm just waiting for a consensus
What is the state with subscription at the moment? How is it done with apollo boost?
Currently apollo-boost
doesn't has subscriptions
I decided to go with apollo-client, apollo-link-ws
To help provide a more clear separation between feature requests / discussions and bugs, and to help clean up the feature request / discussion backlog, Apollo Client feature requests / discussions are now being managed under the https://github.com/apollographql/apollo-feature-requests repository.
Migrated to: https://github.com/apollographql/apollo-feature-requests/issues/13
Most helpful comment
Here's another proposed API:
This way configs for
WebSocketLink
are handled outside of apollo-boost and no more dependencies are needed, when doing SSR (or using something like Next.js) the above will fail cause WebSocketLink will throw an error, so it may also take a function that returns the link and is only called client sideI will be happy to do a PR, it's ready 馃拑