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
320
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
80
NDC London 2017 - Bundling Your front end with webpack
initialspark
0
130
Other Decks in Research
See All in Research
The many faces of AI and the role of mathematics
gpeyre
1
1.5k
CVPR2024 参加報告
kwchrk
0
140
FOSS4G 山陰 Meetup 2024@砂丘 はじめの挨拶
wata909
1
140
20240918 交通くまもとーく 未来の鉄道網編(太田恒平)
trafficbrain
0
420
Practical The One Person Framework
asonas
1
1.9k
[依頼講演] 適応的実験計画法に基づく効率的無線システム設計
k_sato
0
210
移動ビッグデータに基づく地理情報の埋め込みベクトル化
tam1110
0
200
国際会議ACL2024参加報告
chemical_tree
1
380
打率7割を実現する、プロダクトディスカバリーの7つの極意(pmconf2024)
geshi0820
0
170
20241226_くまもと公共交通新時代シンポジウム
trafficbrain
0
290
新規のC言語処理系を実装することによる 組込みシステム研究にもたらす価値 についての考察
zacky1972
1
300
論文紹介: COSMO: A Large-Scale E-commerce Common Sense Knowledge Generation and Serving System at Amazon (SIGMOD 2024)
ynakano
1
270
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Being A Developer After 40
akosma
89
590k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Making Projects Easy
brettharned
116
6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
KATA
mclloyd
29
14k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Code Reviewing Like a Champion
maltzj
521
39k
How to Ace a Technical Interview
jacobian
276
23k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Done Done
chrislema
182
16k
Code Review Best Practice
trishagee
65
17k
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