Git Product home page Git Product logo

Comments (9)

dohomi avatar dohomi commented on August 18, 2024 2

@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.

rnenjoy avatar rnenjoy commented on August 18, 2024 2

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.

dohomi avatar dohomi commented on August 18, 2024

Personally I don't use subscriptions but happy if someone would provide some code to extend the README

from apollo.

rnenjoy avatar rnenjoy commented on August 18, 2024

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.

dohomi avatar dohomi commented on August 18, 2024

@rnenjoy does your code work in your application?

from apollo.

rnenjoy avatar rnenjoy commented on August 18, 2024

Yes dude. Works great! Fixed it last night. Need more help?

from apollo.

dohomi avatar dohomi commented on August 18, 2024

@rnenjoy nope just asking I might extend our README with your ws example so great that you make it work

from apollo.

dohomi avatar dohomi commented on August 18, 2024

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.

dohomi avatar dohomi commented on August 18, 2024

Example is updated in the README

from apollo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.