Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Real-time API's with GraphQL
Search
Sandeep Singh
October 14, 2018
Research
1
310
Real-time API's with GraphQL
Sandeep Singh
October 14, 2018
Tweet
Share
More Decks by Sandeep Singh
See All by Sandeep Singh
NDC OSLO 2017
initialspark
1
170
DDD 12 - Goodbye REST; Hello GraphQL
initialspark
0
1.1k
DDDSouthwest - JavascriptServices: Building Single Page Applications with ASP.NET Core
initialspark
0
79
NDC London 2017 - Bundling Your front end with webpack
initialspark
0
130
Other Decks in Research
See All in Research
MIRU2024チュートリアル「様々なセンサやモダリティを用いたシーン状態推定」
miso2024
3
2.2k
説明可能AIの基礎と研究動向
yuyay
0
140
snlp2024_multiheadMoE
takase
0
420
機械学習による言語パフォーマンスの評価
langstat
6
710
20240918 交通くまもとーく 未来の鉄道網編(こねくま)
trafficbrain
0
210
Embers of Autoregression: Understanding Large Language Models Through the Problem They are Trained to Solve
eumesy
PRO
7
1.2k
Whoisの闇
hirachan
3
120
論文読み会 SNLP2024 Instruction-tuned Language Models are Better Knowledge Learners. In: ACL 2024
s_mizuki_nlp
1
350
大規模言語モデルのバイアス
yukinobaba
PRO
4
690
129 2 th
0325
0
240
最近のVisual Odometryと Depth Estimation
sgk
1
270
[依頼講演] 適応的実験計画法に基づく効率的無線システム設計
k_sato
0
120
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.8k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
The Language of Interfaces
destraynor
154
24k
Adopting Sorbet at Scale
ufuk
73
9.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Navigating Team Friction
lara
183
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How to train your dragon (web standard)
notwaldorf
88
5.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Transcript
Real-Time API’s with GraphQL Sandeep Singh initialspark.co.uk @initial_spark
◦ 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
GraphQL is a declarative query language for your API @initial_spark
@initial_spark
◦Built on specification ◦Hierarchical ◦Client‐driven ◦Strongly typed What is GraphQL?
@initial_spark
Q: Why GraphQL? @initial_spark
◦Efficiency ◦Predictability ◦Versioning ◦Caching ◦Security, tooling, documentation and more Modern
API considerations @initial_spark
Let’s look at an example… @initial_spark
@initial_spark
Efficiency @initial_spark
Efficiency @initial_spark GraphQL API Mongo DB AWS Lamba REST API
SOAP Service HTTP TCP/IP HTTP SOAP Optimisted data for each channel
Versioning Evolution @initial_spark
Tooling & DX @initial_spark
Introspection { __schema{ types{ name } } } • Query
schema, types and fields • Build tools o Auto complete / Validate (graphiql) o Code generation o Documentation @initial_spark
GraphQL Core Concepts @initial_spark
Schema Type System Query Language GraphQL Core Concepts @initial_spark
GraphQL Core Concepts - Resolvers @initial_spark
Schema Type System Query Language o Operations • Queries –
read • Mutations – write • Subscriptions – real-time o Alias o Fragments GraphQL Core Concepts @initial_spark
Lets build a GraphQL API! @initial_spark
@initial_spark
◦ Unpredictable Execution ◦ Handling File Upload ◦ Cache at
Network Level ◦ Authentication/Authorisation GraphQL - Challenges @initial_spark
Q:What about Real-time data? @initial_spark
@initial_spark Chat Notifications Live feed Collaborative
◦ Pull ◦ Polling - Short/Long - HTTP ◦ Push
◦ Subscriptions - Event driven ◦ Live queries - Infinitely fast/cheap polling (State driven) Real-Time API’s @initial_spark
◦ 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
◦ 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
Subscriptions Implementation @initial_spark
Subscriptions (Redis, Kafka, MQ, own?) @initial_spark Request / Response Bi-Directional
Transport (SSE, websockets etc) HTTP Subscription(s) GraphQL Domain Events Events
@initial_spark
Let’s look at another example… @initial_spark
@initial_spark GraphQL API Run Mutation Trigger Subscription subscription {patientDischarged{…}} PAS
View (Admin) Ward View (Nurse)
Lets have some fun with subscriptions @initial_spark
Advanced features – Enrich payload @initial_spark
@initial_spark There isn’t such thing as a free lunch…
◦ Scaling state is hard ◦ Who’s subscribed/ how do
we send messages etc ◦ QOS ◦ Throttling ◦ Buffering Subscriptions - Challenges @initial_spark
◦ 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
Thank you ! You can find me at @initial_spark &
initialspark.co.uk