Open JeffJankowski opened 5 years ago
We've not added support for subscriptions yet (note that pluginHook
only applies to the PostGraphile server and cannot be used with other servers); however you may be able to leverage the underlying subscription schema plugins (appendPlugins
works in all the use-cases as it enhances the schema rather than the server): https://github.com/graphile/graphile-engine/blob/b6fbfb849ee50e29b6c53114cb159dc4f12ddd19/packages/pg-pubsub/src/index.ts#L5-L6
I think you'll need to pass in an extra couple things for it to work; to start with you could try calling this underlying hook method directly on your options:
so it might end up something like
const pluginHook = makePluginHook([PgPubsub]);
const baseOptions = {
pluginHook,
subscriptions: true,
simpleSubscriptions: true
};
const hookedOptions = pluginHook('postgraphile:options', baseOptions, { pgPool });
const { schema, plugin } = await makeSchemaAndPlugin(
pgPool,
'public',
hookedOptions
);
No idea if this will work or not; let me know how you get on!
Hey @benjie
I tried this and do see the Subscription in the schema.
I am having a problem with the JWT token though, it doesn't seem like it's being passed through.
Had to initialize Apollo Server like this:
const app = express();
const server = new ApolloServer({
schema: ...,
...
});
server.applyMiddleware({ app });
const httpServer = http.createServer(app);
server.installSubscriptionHandlers(httpServer);
httpServer.listen(port);
Any ideas?
Is there a particular reason you need the Apollo Server rather than the PostGraphile server? This plugin doesn't support subscriptions currently, and I don't know how to extend it to support subscriptions (I've not looked into it).
Are postgraphile subscriptions supported using this method of hosting an apollo/graphile server?
I tried enabling simple subscriptions, as one would do with an express app, but I'm not seeing the
Subscription
orListenPayload
types in the schema: