Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL Federation Subscriptions #3022

Open
1 task done
mfulton26 opened this issue Sep 26, 2023 · 3 comments
Open
1 task done

GraphQL Federation Subscriptions #3022

mfulton26 opened this issue Sep 26, 2023 · 3 comments
Labels

Comments

@mfulton26
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I want to leverage the new subscriptions support in Apollo Federation but NestJS's docs cause me to think that it isn't supported yet in @nestjs/graphql.

https://www.apollographql.com/blog/announcement/backend/federated-subscriptions-in-graphos-real-time-data-at-scale/#subscriptions-meet-apollo-federation

From https://docs.nestjs.com/graphql/federation:

WARNING
Federation currently does not support subscriptions.

Describe the solution you'd like

Updated docs, support, and example of using subscriptions with Apollo Federation using @nestjs/graphql.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Build microservices that can be used by a client as one GraphQL API even with subscriptions across those microservices.

@kamilmysliwiec
Copy link
Member

Would you like to create PRs for this?

@Hyperxq
Copy link

Hyperxq commented Jan 10, 2024

I've been trying to contribute for the community the way to implement Apollo Subscriptions into Nestjs. I will tell you what is my conclusion after all the research and tries.

Conclusion: You cannot implement it in the free version. Link. However, it's viable with the enterprise version.

In nestjs we use Apollo Gateway and Apollo Subgraph. However, Apollo gateway are not design to support realtime requests: Link. The good news are that Apollo create Apollo Router that improve a lot of things including support for Subscriptions.

You have many differences between using Apollo Gateway and Apollo Router. The main one is that Apollo router is not a npm package instead of it, it is a binary package that you need to download and use it.

I could implement apollo router with all the configurations and I could modify the ApolloFederationDriver to support subscriptions. The problem is when you would like to enable the subscriptions in the router. Because it is an enterprise feature.

@kamilmysliwiec Do you think it is a good idea to implement it anyway?

@mfulton26
Copy link
Author

The documentation hasn't been fully updated yet but GraphQL Yoga supports Apollo Federation for free:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants