PostGraphile support for GraphQL over Server-Sent Events (SSE) powered by graphql-sse.
- Doesn't mess with the schema update stream on
eventSourceRoute, both can exist on the same route PUTandDELETEmethods are allowed through CORS on theeventSourceRoutein order to support the "single connection mode"- The client can use the
X-GraphQL-Event-Streamheader for SSE endpoint discovery
npm install --save graphql-sse @graphile-contrib/graphql-sseor
yarn add graphql-sse @graphile-contrib/graphql-ssepostgraphile \
--plugins @graphile/graphql-sse \
...import { postgraphile, makePluginHook } from 'postgraphile';
import GraphQLSSEPlugin from '@graphile-contrib/graphql-sse';
const postGraphileMiddleware = postgraphile(databaseUrl, 'app_public', {
pluginHook: makePluginHook([GraphQLSSEPlugin]),
eventStreamRoute: '/graphql/stream', // default
});Connect to the specified PostGraphileOptions.eventStreamRoute.
For further usage inspiration, please consult the graphql-sse readme.