1

I would like to add subscriptions into a react project I have which currently references graphql using the port 5000 endpoint created by running postgraphile. I start this using the command line startup of globally installed (via npm -g postgraphile) postgraphile. This works fine.

Via the documentation (https://www.graphile.org/postgraphile/subscriptions/) I see that I should be able to enable subscriptions via the CLI:- https://www.graphile.org/postgraphile/subscriptions/#enabling-with-the-cli-1

However when I run this I get the error:- "Error: Cannot find module '--simple-subscriptions'"

I'm not sure if it's something to do with pg-pubsub. As I installed postgraphile globally, I did the same with pg-pubsub. Therefore rather than:-
postgraphile --plugins @graphile/pg-pubsub --subscriptions --simple-subscriptions etc

I have:-
postgraphile --plugins pg-pubsub --subscriptions --simple-subscriptions etc

However I know it picks up the plugin ok as running it with "-append-plugins MySubscriptionPlugin.js" rather than simple-subscriptions starts the server with "(subscriptions enabled)" listed.

Has anyone managed to get simple subscriptions running via CLI?

Mr Davros
  • 100
  • 10
  • Did you manage to get it working? – Kevin Mamaqi Jul 21 '21 at 10:37
  • Yes, I did in the end - basically "user error" on my behalf! I had globally installed pg-pubsub - which existed but turned out was an earlier version of the plugin which didn't have subscriptions included. Once I'd worked that out (by looking at the package folders) I uninstalled it and installed the updated name spaced @graphile/pg-pubsub. I now have it working using:- start postgraphile --plugins @graphile/pg-pubsub --append-plugins MySubscriptionPlugin.js --subscriptions --simple-subscriptions and it works. – Mr Davros Jul 22 '21 at 11:12

0 Answers0