Express-graphql: How to make Subscription schema ?

Created on 4 Feb 2017  Â·  6Comments  Â·  Source: graphql/express-graphql

I try to make subscription. but cannot get it.

Do you have example code for create simple subscription.

Thank you.

Most helpful comment

@kenshero For what it's worth, you can try out the subscription implementation we have for graphql-server by using graphql-subscriptions and subscriptions-transport-ws.

Here's a blog post we wrote about it a few months ago.

All 6 comments

Thanks for the question!

Subscriptions aren't officially part of the GraphQL spec yet, so we haven't implemented them in express-graphql. @robzhu is actively working now on an RFC for adding subscriptions, and which will be iterated on out in the open once the initial draft is completed ("soon"â„¢). I believe that some third-party libraries like Apollo have implemented experimental versions of subscriptions, so we'll see how closely they align with the spec by the time it has finished going through the RFC process. But for now, I think I can close this because there's no "official" way to do this in express-graphql at this time.

@kenshero For what it's worth, you can try out the subscription implementation we have for graphql-server by using graphql-subscriptions and subscriptions-transport-ws.

Here's a blog post we wrote about it a few months ago.

+1

Hi @wincent @robzhu any info when we can get subscription as part of express-graphql.

@jalalat, Assuming you mean an end-to-end working GraphQL Subscriptions system, this is unlikely to become part of express-graphql itself for two reasons:
1) Subscriptions generally requires some way to detect and trigger domain-specific events (most people use a pubsub system for this)
2) Subscriptions requires a persistent, bi-directional transport between the client and server.

These are both application-specific decisions. We would not want to expand the scope of express-graphql to include all possible integrations/configurations of surrounding systems.

See @helfer's post above for some ideas on how to add subscription support in production.

Ok, how to teach graphiql to listen additional endpoint for subscriptions?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhurlburtusa picture dhurlburtusa  Â·  4Comments

macin40 picture macin40  Â·  4Comments

KieronWiltshire picture KieronWiltshire  Â·  3Comments

violet-day picture violet-day  Â·  3Comments

naivefun picture naivefun  Â·  3Comments