Before April 2019, PostGraphile had rudimentary support for GraphQL
subscriptions available only to
Patreon supporters via "the supporter plugin"
which was originally only available over a custom
git URL, but later was moved
npm for easier installation. If you were not one of these users then this
article isn't for you.
With v4.4.0, PostGraphile's subscriptions support was extended and open-sourced.
@graphile/supporter are encouraged to move to using the open source
subscriptions plugin, which should only take a few minutes.
Step 1: uninstall the outdated module
For the npm module:
yarn remove @graphile/supporter
git module, edit your
package.json and remove the relevant line and
Step 2: install the new module
yarn add @graphile/pg-pubsub
Step 3: switch to using the new module
makePluginHookline should now reference the
@graphile/pg-pubsubplugin rather than the supporter plugin
- Add the
subscriptions: truePostGraphile option
- If you use
enhanceHttpServerWithSubscriptionsthen instead of importing it from the supporter plugin, now import it from
postgraphiledirectly. The call signature is now
enhanceHttpServerWithSubscriptions(httpServer, postgraphileMiddleware)- see Subscriptions Advanced Setup.
- If you were passing
enhanceHttpServerWithSubscriptions; you should instead pass these middlewares as
--plugins @graphile/supporter to
--plugins @graphile/pg-pubsub and
Now PostGraphile natively supports subscriptions, our built in GraphiQL (http://localhost:5000/graphiql by default) now supports subscriptions too, so it's easier than ever to try out a subscription. Also note we have experimental support for live queries.