Sistemas y Tecnologías Web: Servidor

Master de II. ULL. 1er cuatrimestre


Organization ULL-MII-SYTWS-2122   Classroom ULL-MII-SYTWS-2122   Campus Virtual SYTWS   Chat Chat   Profesor Casiano

GraphQL-subscriptions

Goals

Follow the two tutorials below and reproduce the steps.

First Example: Hello Subscriptions

See the section hello subscriptions

Second Example: GraphQL Subscriptions with Node.js

See section GraphQL Subscriptions with Node.js

Challenge

Write a graphQL server tha counts the accepts hello queries like:

query paula {
  hello(name: "paula")
}

query pablo {
  hello(name: "pablo")
}

query nico {
  hello(name: "nicolas")
}

and clients can subscribe to a greetings event that occurs each time a hello query occurs. The event triggered by the hello is an object that has not only the name greeted but also the number of times it has been greeted.

Therefore queries like this one must be supported:

subscription {
  counter {
    name
    count
  }
}

You can find a solution in the folder subscriptions/hello-name of the repo crguezl/graphql-yoga-examples

References

Comment with GitHub Utterances