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
but later was moved to
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. Users of
@graphile/supporter are encouraged to move
to using the open source subscriptions plugin, which should only
take a few minutes.
For the npm module:
yarn remove @graphile/supporter
git module, edit your
package.json and remove the relevant line and then run
yarn add @graphile/pg-pubsub
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 add the
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.