Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.
This repository was archived by the owner on May 17, 2025. It is now read-only.

How to Filter? #311

@allran

Description

@allran

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions