Skip to content

DataStore to establish Subscription with server-side filtering #2728

Open
@lawmicha

Description

@lawmicha

DataStore translates the syncExpression over to the filter predicate on the GrapQL query. When DataStore performs a sync query, the filter is added, to perform server side filtering. When DataStore establishes the subscriptions, the filtering is applied on the client side.Since the subscription filtering feature released in April 2022, customers can provision AppSync with the filter input capability on their subscription operations. DataStore can now leverage this by passing in filter to the subscription request.

  1. We attempt the subscription with the filter and catch ther error
  2. Handle the specific "RTF" error as a retry without the filter for backwards compatibility.

References
https://github.com/aws-amplify/amplify-js/blob/main/packages/datastore/src/sync/processors/subscription.ts#L467-L492

https://github.com/aws-amplify/amplify-js/blob/main/packages/datastore/src/sync/processors/subscription.ts#L677-L682C10

This logic allows for backwards compatibility with AppSync backends without the subscription filter capability.

Originally posted by @lawmicha in aws-amplify/amplify-swift#3550 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions