1

I'm planning to Apollo-Graphql on Google App Engine (GAE). So I don't have to worry about the scaling (I'll be using Redis or some other pubsub). However, the problem is GAE doesn't support web sockets. I heavily use GraphQL subscriptions.

What Google recommends is to separate web socket into another VM (like Google Compute Engine) and keep the rest inside GAE: https://cloud.google.com/solutions/real-time-gaming-with-node-js-websocket

Is it possible to do this on Apollo Server? I'm using node js apollo-server-express

Gijo Varghese
  • 11,264
  • 22
  • 73
  • 122

1 Answers1

1

It's a good pattern to scale your infra. There is no contraindication to use apollo-server-express/Apollo-Graphql.

Use the same code base, one will handle query and mutation with http and the other will handle subscribe with websocket. Just route correct network to (GAE) or Google Compute Engine.

Every http query will be handle by GAE. And apollo-client will subscribe ws query on Google Compute Engine. When one event is publish on Redis or other, apollo-graph will consume and resolve only if their is subscriber on ws.

So you don't need connect pubsub/Redis on GAE.

I was considering using 2 projects for http and ws but it won't share graphQL schemas.

Tobino
  • 932
  • 8
  • 15