Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Real-time API's with GraphQL

Sandeep Singh
October 14, 2018

Real-time API's with GraphQL

Sandeep Singh

October 14, 2018
Tweet

More Decks by Sandeep Singh

Other Decks in Research

Transcript

  1. ◦ What is GraphQL ? ◦ Why it exists and

    the problems it aims to solve ? ◦ GraphQL core concepts ◦ Real-Time API’s – the what, why and how Agenda @initial_spark
  2. Efficiency @initial_spark GraphQL API Mongo DB AWS Lamba REST API

    SOAP Service HTTP TCP/IP HTTP SOAP Optimisted data for each channel
  3. Introspection { __schema{ types{ name } } } • Query

    schema, types and fields • Build tools o Auto complete / Validate (graphiql) o Code generation o Documentation @initial_spark
  4. Schema Type System Query Language o Operations • Queries –

    read • Mutations – write • Subscriptions – real-time o Alias o Fragments GraphQL Core Concepts @initial_spark
  5. ◦ Unpredictable Execution ◦ Handling File Upload ◦ Cache at

    Network Level ◦ Authentication/Authorisation GraphQL - Challenges @initial_spark
  6. ◦ Pull ◦ Polling - Short/Long - HTTP ◦ Push

    ◦ Subscriptions - Event driven ◦ Live queries - Infinitely fast/cheap polling (State driven) Real-Time API’s @initial_spark
  7. ◦ Real time events ◦ Idea: Server pushes data to

    client when something ‘interesting’ occurs ◦ The client defines the shape of the data pushed to it Subscriptions – Event Based @initial_spark
  8. ◦ The initial state is large, but the incremental change

    sets are small ◦ You care about low-latency updates in the case of specific events, e.g. chat application where users expect to receive new messages in a matter of seconds Subscriptions – When to use @initial_spark
  9. Subscriptions (Redis, Kafka, MQ, own?) @initial_spark Request / Response Bi-Directional

    Transport (SSE, websockets etc) HTTP Subscription(s) GraphQL Domain Events Events
  10. ◦ Scaling state is hard ◦ Who’s subscribed/ how do

    we send messages etc ◦ QOS ◦ Throttling ◦ Buffering Subscriptions - Challenges @initial_spark
  11. ◦ http://graphql.org/learn/ ◦ https://www.youtube.com/watch?v=bn8qsi8jVew - Lee Byron ◦ https://github.com/apollographql/apollo-client ◦

    https://github.com/initialspark/real-time-apis-graphql ◦ https://www.graphqlhub.com/ ◦ https://www.youtube.com/watch?v=4_Bcw7BULC8 - Authentication Resources @initial_spark