graphql-lambda-subscriptions icon indicating copy to clipboard operation
graphql-lambda-subscriptions copied to clipboard

How to Filter?

Open allran opened this issue 3 years ago • 0 comments

When need send message, how to filter the target to get data? I only find follow code async filter(root, args, context) { return { error: false, } },

for example, is there have like pubsub.asyncIterator(triggers).next()to find the target?

import { withFilter } from 'graphql-subscriptions'
subscribe: withFilter(
          () => pubsub.asyncIterator('NEW_MESSAGE'),
          (payload, variables) => {
        console.log('---------------messageFeed start-------------------')
        console.log('::Subscription subscribe payload 发消息方:%s \nvariables 订阅收消息方:%s', payload, variables)

Then, When i get payload and variables data, i can compare if neet subscription message.

allran avatar Jan 07 '23 07:01 allran