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

Vue subscriptions example #119

Open
benjie opened this issue Mar 26, 2019 · 1 comment
Open

Vue subscriptions example #119

benjie opened this issue Mar 26, 2019 · 1 comment

Comments

@benjie
Copy link
Member

benjie commented Mar 26, 2019

 apollo: {
    $subscribe: {
        tagAdded: {
        query: gqlsubscription test{listen(topic: "hello"){relatedNodeId}},
        // Reactive variables
        variables () {
          // This works just like regular queries
          // and will re-subscribe with the right variables
          // each time the values change
          return {
            type: this.type,
          }
        },
        // Result hook
        result (data) {
          console.log(data)
        },
      },
    },

https://discordapp.com/channels/489127045289476126/498852330754801666/560214820121739285

@francoisp
Copy link

francoisp commented Mar 26, 2019

thanks again for the pointer benjie, here it is with the few missing backticks, for the next guy that will paste this in and might be wondering...

apollo: {
$subscribe: {
    tagAdded: {
    query: gql`subscription {listen(topic: "hello"){relatedNodeId}}`,
    // Reactive variables
    variables () {
      // This works just like regular queries
      // and will re-subscribe with the right variables
      // each time the values change
      return {
        type: this.type,
      }
    },
    // Result hook
    result (data) {
      console.log(data)
    },
  },
},
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@benjie @francoisp and others