Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@giraphql/plugin-smart-subscriptions

1.1.0 • Public • Published

Smart Subscriptions Plugin for GiraphQL

This plugin provides a way of turning queries into graphql subscriptions. Each field, Object, and Interface in a schema can define subscriptions to be registerd when that field or type is used in a smart subscription.

The basic flow of a smart subscription is:

  1. Run the query the smart subscription is based on and push the initial result of that query to the subsciption
  2. As the query is resolved, register any subscriptions defined on fields or types that where used in the query
  3. When any of the subscriptions are triggered, re-execute the query and push the updated data to the subsciption.

There are additional options which will allow only the sub-tree of a field/type that triggered a fetch to re-resolved.

This pattern makes it easy to define subscriptions without having to worry about what parts of your schema are accessible via the subscribe query, since any type or field can register a subscrption.

Full docs available at https://giraphql.com/plugins-smart-subscriptions

Install

npm i @giraphql/plugin-smart-subscriptions

DownloadsWeekly Downloads

177

Version

1.1.0

License

ISC

Unpacked Size

282 kB

Total Files

57

Last publish

Collaborators

  • avatar