Custom filtering on subscription in AWS AppSync

◇◆丶佛笑我妖孽 提交于 2019-12-10 12:32:19

问题


Is it possible to have custom filtering logic on subscription in AWS AppSync?

As I know, current behavior is: e.g. my schema is like the following

type Mutation {
  createEvent(userId: ID!, event: Event!): Event!
}

type Subscription {
  onEvent(userId: ID!): Event!
  @aws_subscribe(mutations: ["createEvent"])
}

Current behavior of AppSync is, when I trigger createEvent, AppSync promise that the subscriber of Subscription receive the Event if the userId are equal. i.e. the filtering logic of AppSync is sth like

if (Muatation.userId == Subscription.userId) {
  // forward to subscriber
}

But what if I want different filtering logic? For example, I want to subscribe all other events except those triggered by me? i.e.

if (Muatation.userId != Subscription.userId) {
  // forward to subscriber
}

So, is it possible to have custom filtering logic in AppSync?


回答1:


Currently, this use case is not supported by AppSync.

Adding custom filtering may be considered in the future.



来源:https://stackoverflow.com/questions/50037650/custom-filtering-on-subscription-in-aws-appsync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!