Comments (9)
@lolcoolkat your question should be better posted in https://github.com/Akryum/vue-apollo, this package is just the wrapper for vue-apollo code
from apollo.
This is my clientDefault config file:
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { WebSocketLink } from 'apollo-link-ws'
import { SubscriptionClient } from 'subscriptions-transport-ws'
export default (ctx) => {
let link = null
if (ctx.isServer) {
link = new HttpLink({ uri: 'http://localhost:3000/graphql' })
} else {
const client = new SubscriptionClient('ws://localhost:3001/graphql', {
reconnect: true
})
link = new WebSocketLink(client)
}
const cache = new InMemoryCache()
return {
link,
cache
}
}
Server side uses HTTP Link, Client uses Websocket link.
from apollo.
Personally I don't use subscriptions but happy if someone would provide some code to extend the README
from apollo.
Yes this only has the httpLink. How would it look like with a subscription ws link?
https://www.apollographql.com/docs/link/links/ws.html
from apollo.
@rnenjoy does your code work in your application?
from apollo.
Yes dude. Works great! Fixed it last night. Need more help?
from apollo.
@rnenjoy nope just asking I might extend our README with your ws example so great that you make it work
from apollo.
By the way, here a current example for Angular 2 just in case someone wants to adopt some code: https://alligator.io/angular/graphql-subscriptions/
from apollo.
Example is updated in the README
from apollo.
Related Issues (20)
- $apollo and $apolloHelpers are unknown HOT 2
- How to use nuxtjs/apollo with apollo-upload-client HOT 1
- Nuxt can't start with apollo HOT 1
- Evict({}) not working HOT 1
- SSR renders template after useQuery is resolved HOT 2
- Type Inference breaks with `bundler` resolution HOT 2
- Support cache persistence configuration
- Apollo client not found HOT 2
- [useAsyncData] Component is already mounted, please use $fetch instead HOT 1
- Variables passed as ref are not passed along to apollo
- Can't access result.value after successful query on first load HOT 1
- Module '"@nuxtjs/apollo"' has no exported member 'defineApolloClient' HOT 1
- Relative API url doesn't work with SSR HOT 1
- _isomorphicFetch is not defined
- Multiple calls to `useAsyncQuery` from composable function causes 500 error in SSR HOT 2
- useQuery throws error if clientId supplied HOT 1
- fetchMore function missing in useAsyncQuery
- Failed to import useQuery HOT 1
- GraphQL playground on local server?
- Multiple clients aren't working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo.