Skip to content

Vue subscriptions example #119

Open
Open

Description

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

Activity

  1. francoisp commented on Mar 26, 2019

    @francoisp

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions