hasura / 3factor

3factor app is an architecture pattern for modern fullstack apps. 3factor apps are fast to build and are highly scalable.

Home Page:https://3factor.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL Subscriptions in "serverless"

nickswiss opened this issue · comments

The documentation notes many times that this is a server-less architecture, but I'm having trouble understanding how you would achieve this without a running graphql server to handle the publisher-subscriber websocket notifications.

It also mentions numerous times that the microservices write to the state, and that the graphql API subscribe to the state changes, but this does not really fit into the graphql pub sub format either.

From all documents I've seen, the subscription logic, and subscription events are handled inside the graphql mutation functions:

Mutation: {
   addEvent() {
      do crud on db
      send websocket notification to subscribers with crud data
   }
}

The diagrams seem to point that graphql is somehow listening on the database for changes which is not the case.

Can you clarify how a graphql subscribes to state changes without actually adding the pub sub logic in the graphql layer?

@nickswiss I think this explains how "graphql is listening on the database", although it is not graphql the query language but the engine powering the graphql enabled API - https://github.com/hasura/skor