SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Jayson Hsieh
Solutions Architect, Amazon Web Services
Taking Your Progressive Web App
To The Next Level With
GraphQL And AWS Appsync
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Digital Media
50%
34%
9%
7%
Mobile App Desktop Mobile Web Tablet App
Time spent
comScore Media Metrix Multi-Platform & Mobile Metrix, U.S., Total Audience, June 2017
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
comScore Media Metrix Multi-Platform & Mobile Metrix, U.S., Total Audience, June 2017
0
5
11
16
21
Unique Visitors
Mobile Web Mobile App
Average Monthly
Unique Visitors
2.2x
Mobile
App
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Progress To Progressive
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Progressive Web Apps (PWA)
Responsive web
application
Defined by
manifest.json
Discoverable and
installable
A Progressive Web App uses
modern web capabilities
to deliver
an app-like user experience
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why Progressive Web Apps
Secure ShareableNetwork Agnostic Always up-to-date
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Core Components
Application shell Service worker Storage and cache
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Toolchain And Production Scale
• Web framework (Ember.js, Angular.js, Ionic, React, etc.)
• CLI/build system (Workbox, Ionic, Grunt/Gulp, AWS CLI)
• Libraries/utilities (Local Forage, Handlebars)
• Deployment (CloudFront, S3, AWS Mobile CLI, Mobile Hub)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What About The Backend?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Traditional Data Fetching
Data
ü Trivial to set up
ü Standard HTTP Calls
Relationships
Lists with reduced information
Query support
Ordering and pagination
Notifications
/posts
/postInfo
/postJustTitle
/postsByAuthor
/postNameStartsX
/postByTag
/commentsOnPost
REST Endpoints
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Is There A Better Way
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What Is GraphQL?
Describe what’s possible
with a type system
Uniform API across data stores
and APIs
Network optimised
requests and responses
Powerful developer tools Integrated
documentation and
introspection
Query language for your API
and a runtime for fulfilling
queries with existing data
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What Is GraphQL?
/posts /comments /authors
REST API
/posts /comments /authors
GraphQL API
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How To Use GraphQL
type Query {
listEvents: [Event]
}
type Event {
id: ID!
name: String!
when: String!
where: String!
}
query {
listEvents {
id
name
}
}
{
"id": "1",
"name": "React Meet Up"
},
{
"id": "2",
"name": "GraphQL Party"
},
{
“id”: “3”,
“name”: “Angular Sesh”
}
...
Define your data
(Schema)
Invoke Operation Get EXACTLY what
you asked for
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How To Use GraphQL
type Query {
listEvents: [Event]
}
type Event {
id: ID!
name: String!
when: String!
where: String!
}
query {
listEvents {
id
name
when
}
}
{
"id": "1”,
"name": "React Meet Up”,
“when”: “Tomorrow”
},
{
"id": "2",
"name": "GraphQL Party",
“when”: “Saturday”
},
{
“id”: “3”,
“name”: “Angular Sesh”,
“when”: “Next Friday”
}
...
Define your data
(Schema)
Invoke Operation Get EXACTLY what
you asked for
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL sounds legit!
I want to run my own GraphQL server!!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introducing AWS AppSync
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync
Managed Serverless
GraphQL service
Connect to data
sources in your account
Add data sync, real-time and
offline capabilities for any data
source or API
GraphQL façade for any
AWS service
Conflict detection and
resolution in the cloud
Enterprise security features
(IAM, Cognito, API keys)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How Does AppSync Work?
Create, Import or Upload
GraphQL Schema
Amazon
Elasticsearch
Amazon
DynamoDB
AWS Lambda
Connect Data
Sources with
GraphQL Resolvers
AppSync Updates Data
in Real Time and Manages
Data when Offline
__________
______________
___________
_________
___________
____________
__________
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Mutations
Write Data
mutation {
createEvent(name:”MeetUp”){
id
}
}
GraphQL Operations
Queries
Read Data
query {
getEvent(id: 1){
id
name
}
}
Subscriptions
Receive Data in
Real-Time
subscription {
onCreateComment {
id
}
}
Queries
Read Data
Mutations
Write Data
Subscriptions
Receive Data in Real-Time
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building Data-Driven Apps With AWS Appsync
Robust, scalable storage
capable of handling
millions of events a day
Geospatial
search
Real-time
updates for both
mobile and web
Mobile and Web
clients
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Clients receive the data
they ask for. Nothing
more, nothing less
Get many resources from
many data sources with a
single request
Self-documenting APIs with
Introspection
React Native, Android,
iOS, and Web (JS) using
the Apollo GraphQL client
Data persistence across
application restarts
Write-through mutations with
optimistic UI
AWS AppSync Benefits
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Real-Time Updates
• GraphQL subscriptions
• Event stream of mutation results
• Data synchronisation with MQTT + WebSockets
• Client managed WebSocket connection
• Automatic catch-up snapshots
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Elasticsearch
Amazon DynamoDB
Browser
Mobile
device WebSocket
servers
Web servers
PubSub
servers
Subscription
/search
/taps
/taps/:id
/m_search
AWS Lambda
Third-party service
…
Real-Time App Before AppSync
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
/graphql
AWS AppSync
Subscription Amazon Elasticsearch
Amazon DynamoDB
AWS Lambda
Third-party service
Real-Time App After AppSync
Resolvers
DataSources
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Data Conflicts
Jane
Version : 2 Updated Document
Jane
Version : 2 Updated Document
Version : 3 Updated Document
Version : 1 New Document
Time
John
John
Jane goes offline
Jane comes back online
Version : 4 Updated Document
John
Jane
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Handle Data Conflicts In The Cloud
• Conflict detection with optimistic version check
• Conflict resolution strategies:
A. Client wins
B. Server wins
C. Silent reject
D. Custom logic in AWS Lambda
• Client callback for conflict resolution is available
"condition" : {
"expression" : "someExpression"
"conditionalCheckFailedHandler" : {
"strategy" : "Custom",
"lambdaArn" : "arn:..."
}
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Offline Capabilities - AppSync Client Storage
• Offline is a write-through "Store"
• Persistent storage mediums back the Apollo
normalised cache
• Local Storage for web
• AsyncStorage for React Native
• SQLite on native platforms
• Database can be preloaded
• Offline client can be configured
• WiFi only
• WiFi and cellular
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway AWS AppSync
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway AWS AppSync
vs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway AWS AppSync
vs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway AWS AppSync
&
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API Gateway AWS AppSync
&
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Enough Talking…
https://github.com/aws-samples/aws-mobile-appsync-chat-starter-angular
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon
Cognito
User Pools
JWT Token
GraphQL
Schema
ChatQL
Conversations
Table
Messages
Table
User Conversations
Table
Users Table
Amazon
DynamoDB
Queries and Mutations
Subscriptions
AppSync
Resolvers
User
AWS AppSync
AppSync Data Sources
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
User
1..1
1..n
1..1
1..n
1..n
User
Conversation
Conversation Messages
GraphQL Relations between NoSQL DynamoDB Tables
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo Time!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Takeaways
Don’t boil the ocean. Start small
and iterate on Offline (cache-and-
network), Real-time and Conflict
Resolution
Use UI cues with
Optimistic UI when
Offline
Take advantage of built-in
GraphQL powerful features
such as Connections
(Pagination) and Relations
(NoSQL)
It’s all about the
User Experience:
PWAs + AppSync = J
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank You

Contenu connexe

Tendances

A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018
A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018
A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018Amazon Web Services
 
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)Amazon Web Services
 
AWS 良好架構服務概述 (Level: 200)
AWS 良好架構服務概述 (Level: 200)AWS 良好架構服務概述 (Level: 200)
AWS 良好架構服務概述 (Level: 200)Amazon Web Services
 
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...Amazon Web Services
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless AppsAmazon Web Services
 
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018Amazon Web Services
 
AWS 微服務中的 Container 選項比較 (Level 400)
AWS 微服務中的 Container 選項比較   (Level 400)AWS 微服務中的 Container 選項比較   (Level 400)
AWS 微服務中的 Container 選項比較 (Level 400)Amazon Web Services
 
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...Amazon Web Services
 
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018Amazon Web Services
 
Compliance and Security Mitigation Techniques
Compliance and Security Mitigation TechniquesCompliance and Security Mitigation Techniques
Compliance and Security Mitigation TechniquesAmazon Web Services
 
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018Amazon Web Services
 
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...Amazon Web Services
 
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...Amazon Web Services
 
Work Anywhere with Amazon Workspaces (Level: 200)
Work Anywhere with Amazon Workspaces (Level: 200)Work Anywhere with Amazon Workspaces (Level: 200)
Work Anywhere with Amazon Workspaces (Level: 200)Amazon Web Services
 
Multi-Account Strategy and Security with Centrica Hive
Multi-Account Strategy and Security with Centrica HiveMulti-Account Strategy and Security with Centrica Hive
Multi-Account Strategy and Security with Centrica HiveAmazon Web Services
 
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...Amazon Web Services
 
Introduction to Amazon EC2 F1 Instances
Introduction to Amazon EC2 F1 Instances Introduction to Amazon EC2 F1 Instances
Introduction to Amazon EC2 F1 Instances Amazon Web Services
 
Using Containers and Serverless to Deploy Microservices
Using Containers and Serverless to Deploy MicroservicesUsing Containers and Serverless to Deploy Microservices
Using Containers and Serverless to Deploy MicroservicesAmazon Web Services
 
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...Amazon Web Services
 

Tendances (20)

A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018
A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018
A Chronicle of Airbnb Architecture Evolution (ARC407) - AWS re:Invent 2018
 
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)
雲端原生 (Cloud-Native) 的 DDoS Attack 防禦方案 (Level: 200)
 
AWS 良好架構服務概述 (Level: 200)
AWS 良好架構服務概述 (Level: 200)AWS 良好架構服務概述 (Level: 200)
AWS 良好架構服務概述 (Level: 200)
 
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...
Inside AWS: Technology Choices for Modern Applications (SRV305-R1) - AWS re:I...
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless Apps
 
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018
Machine Learning at the IoT Edge (IOT214) - AWS re:Invent 2018
 
AWS 微服務中的 Container 選項比較 (Level 400)
AWS 微服務中的 Container 選項比較   (Level 400)AWS 微服務中的 Container 選項比較   (Level 400)
AWS 微服務中的 Container 選項比較 (Level 400)
 
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...
Mythical Mysfits: Management and Ops with AWS Fargate (CON322-R1) - AWS re:In...
 
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
AWS and Symantec: Cyber Defense at Scale (SEC311-S) - AWS re:Invent 2018
 
Compliance and Security Mitigation Techniques
Compliance and Security Mitigation TechniquesCompliance and Security Mitigation Techniques
Compliance and Security Mitigation Techniques
 
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018
Observability for Modern Applications (CON306-R1) - AWS re:Invent 2018
 
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
Perform Machine Learning at the IoT Edge using AWS Greengrass and Amazon Sage...
 
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...
Announcing AWS RoboMaker: A New Cloud Robotics Service (ROB201-R) - AWS re:In...
 
Work Anywhere with Amazon Workspaces (Level: 200)
Work Anywhere with Amazon Workspaces (Level: 200)Work Anywhere with Amazon Workspaces (Level: 200)
Work Anywhere with Amazon Workspaces (Level: 200)
 
Multi-Account Strategy and Security with Centrica Hive
Multi-Account Strategy and Security with Centrica HiveMulti-Account Strategy and Security with Centrica Hive
Multi-Account Strategy and Security with Centrica Hive
 
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...
Reliable & Scalable Redis in the Cloud with Amazon ElastiCache (DAT202) - AWS...
 
Introduction to Amazon EC2 F1 Instances
Introduction to Amazon EC2 F1 Instances Introduction to Amazon EC2 F1 Instances
Introduction to Amazon EC2 F1 Instances
 
Using Containers and Serverless to Deploy Microservices
Using Containers and Serverless to Deploy MicroservicesUsing Containers and Serverless to Deploy Microservices
Using Containers and Serverless to Deploy Microservices
 
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...
Leadership Session: Learn about 10 Years' of Windows and .NET Innovation on A...
 
BDA310 Transcribe and Translate
BDA310 Transcribe and TranslateBDA310 Transcribe and Translate
BDA310 Transcribe and Translate
 

Similaire à 善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)

Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018Amazon Web Services
 
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSyncTaking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSyncAmazon Web Services
 
Building your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSyncBuilding your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSyncAmazon Web Services
 
Building your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSyncBuilding your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSyncAmazon Web Services
 
Nader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdfNader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdfAmazon Web Services
 
Build your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS AmplifyBuild your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS AmplifyAmazon Web Services
 
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...Amazon Web Services
 
Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...AWS Germany
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...AWS Germany
 
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...Amazon Web Services
 
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...Amazon Web Services
 
Building Real-time Serverless Backends
Building Real-time Serverless BackendsBuilding Real-time Serverless Backends
Building Real-time Serverless BackendsAmazon Web Services
 
Build a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSyncBuild a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSyncAmazon Web Services
 
Cloud Backend for Real-time Applications
Cloud Backend for Real-time ApplicationsCloud Backend for Real-time Applications
Cloud Backend for Real-time ApplicationsAmazon Web Services
 
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Amazon Web Services
 
Building Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLBuilding Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLAmazon Web Services
 
Supercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSyncSupercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSyncAmazon Web Services
 
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...Gaining Visibility and Insight into Your Distributed Applications with AWS X-...
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...Amazon Web Services
 

Similaire à 善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200) (20)

Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
 
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSyncTaking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
 
Building your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSyncBuilding your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSync
 
Building your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSyncBuilding your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSync
 
Nader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdfNader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdf
 
Build your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS AmplifyBuild your APPs in Lean and Agile Way using AWS Amplify
Build your APPs in Lean and Agile Way using AWS Amplify
 
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...
Leadership Session: Developing Mobile & Web Apps on AWS (MOB202-L) - AWS re:I...
 
Microservices for Startups
Microservices for StartupsMicroservices for Startups
Microservices for Startups
 
Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...
 
Introduzione a GraphQL
Introduzione a GraphQLIntroduzione a GraphQL
Introduzione a GraphQL
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
 
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
Build a Photo-Sharing App with AI-Powered Face and Object Detection (MOB306) ...
 
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...
Bridging the Gap Between Real Time/Offline and AI/ML Capabilities in Modern S...
 
Building Real-time Serverless Backends
Building Real-time Serverless BackendsBuilding Real-time Serverless Backends
Building Real-time Serverless Backends
 
Build a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSyncBuild a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSync
 
Cloud Backend for Real-time Applications
Cloud Backend for Real-time ApplicationsCloud Backend for Real-time Applications
Cloud Backend for Real-time Applications
 
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
Instrumenting Kubernetes for Observability Using AWS X-Ray and Amazon CloudWa...
 
Building Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQLBuilding Real-time Serverless Backends with GraphQL
Building Real-time Serverless Backends with GraphQL
 
Supercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSyncSupercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSync
 
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...Gaining Visibility and Insight into Your Distributed Applications with AWS X-...
Gaining Visibility and Insight into Your Distributed Applications with AWS X-...
 

Plus de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)

  • 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Jayson Hsieh Solutions Architect, Amazon Web Services Taking Your Progressive Web App To The Next Level With GraphQL And AWS Appsync
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Digital Media 50% 34% 9% 7% Mobile App Desktop Mobile Web Tablet App Time spent comScore Media Metrix Multi-Platform & Mobile Metrix, U.S., Total Audience, June 2017
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. comScore Media Metrix Multi-Platform & Mobile Metrix, U.S., Total Audience, June 2017 0 5 11 16 21 Unique Visitors Mobile Web Mobile App Average Monthly Unique Visitors 2.2x Mobile App
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Progress To Progressive
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Progressive Web Apps (PWA) Responsive web application Defined by manifest.json Discoverable and installable A Progressive Web App uses modern web capabilities to deliver an app-like user experience
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Why Progressive Web Apps Secure ShareableNetwork Agnostic Always up-to-date
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Core Components Application shell Service worker Storage and cache
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Toolchain And Production Scale • Web framework (Ember.js, Angular.js, Ionic, React, etc.) • CLI/build system (Workbox, Ionic, Grunt/Gulp, AWS CLI) • Libraries/utilities (Local Forage, Handlebars) • Deployment (CloudFront, S3, AWS Mobile CLI, Mobile Hub)
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What About The Backend?
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Traditional Data Fetching Data ü Trivial to set up ü Standard HTTP Calls Relationships Lists with reduced information Query support Ordering and pagination Notifications /posts /postInfo /postJustTitle /postsByAuthor /postNameStartsX /postByTag /commentsOnPost REST Endpoints
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Is There A Better Way
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What Is GraphQL? Describe what’s possible with a type system Uniform API across data stores and APIs Network optimised requests and responses Powerful developer tools Integrated documentation and introspection Query language for your API and a runtime for fulfilling queries with existing data
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What Is GraphQL? /posts /comments /authors REST API /posts /comments /authors GraphQL API
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How To Use GraphQL type Query { listEvents: [Event] } type Event { id: ID! name: String! when: String! where: String! } query { listEvents { id name } } { "id": "1", "name": "React Meet Up" }, { "id": "2", "name": "GraphQL Party" }, { “id”: “3”, “name”: “Angular Sesh” } ... Define your data (Schema) Invoke Operation Get EXACTLY what you asked for
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How To Use GraphQL type Query { listEvents: [Event] } type Event { id: ID! name: String! when: String! where: String! } query { listEvents { id name when } } { "id": "1”, "name": "React Meet Up”, “when”: “Tomorrow” }, { "id": "2", "name": "GraphQL Party", “when”: “Saturday” }, { “id”: “3”, “name”: “Angular Sesh”, “when”: “Next Friday” } ... Define your data (Schema) Invoke Operation Get EXACTLY what you asked for
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL sounds legit! I want to run my own GraphQL server!!
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Introducing AWS AppSync
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync Managed Serverless GraphQL service Connect to data sources in your account Add data sync, real-time and offline capabilities for any data source or API GraphQL façade for any AWS service Conflict detection and resolution in the cloud Enterprise security features (IAM, Cognito, API keys)
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How Does AppSync Work? Create, Import or Upload GraphQL Schema Amazon Elasticsearch Amazon DynamoDB AWS Lambda Connect Data Sources with GraphQL Resolvers AppSync Updates Data in Real Time and Manages Data when Offline __________ ______________ ___________ _________ ___________ ____________ __________
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Mutations Write Data mutation { createEvent(name:”MeetUp”){ id } } GraphQL Operations Queries Read Data query { getEvent(id: 1){ id name } } Subscriptions Receive Data in Real-Time subscription { onCreateComment { id } } Queries Read Data Mutations Write Data Subscriptions Receive Data in Real-Time
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building Data-Driven Apps With AWS Appsync Robust, scalable storage capable of handling millions of events a day Geospatial search Real-time updates for both mobile and web Mobile and Web clients
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Clients receive the data they ask for. Nothing more, nothing less Get many resources from many data sources with a single request Self-documenting APIs with Introspection React Native, Android, iOS, and Web (JS) using the Apollo GraphQL client Data persistence across application restarts Write-through mutations with optimistic UI AWS AppSync Benefits
  • 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Real-Time Updates • GraphQL subscriptions • Event stream of mutation results • Data synchronisation with MQTT + WebSockets • Client managed WebSocket connection • Automatic catch-up snapshots
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Elasticsearch Amazon DynamoDB Browser Mobile device WebSocket servers Web servers PubSub servers Subscription /search /taps /taps/:id /m_search AWS Lambda Third-party service … Real-Time App Before AppSync
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. /graphql AWS AppSync Subscription Amazon Elasticsearch Amazon DynamoDB AWS Lambda Third-party service Real-Time App After AppSync Resolvers DataSources
  • 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Data Conflicts Jane Version : 2 Updated Document Jane Version : 2 Updated Document Version : 3 Updated Document Version : 1 New Document Time John John Jane goes offline Jane comes back online Version : 4 Updated Document John Jane
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Handle Data Conflicts In The Cloud • Conflict detection with optimistic version check • Conflict resolution strategies: A. Client wins B. Server wins C. Silent reject D. Custom logic in AWS Lambda • Client callback for conflict resolution is available "condition" : { "expression" : "someExpression" "conditionalCheckFailedHandler" : { "strategy" : "Custom", "lambdaArn" : "arn:..." } }
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Offline Capabilities - AppSync Client Storage • Offline is a write-through "Store" • Persistent storage mediums back the Apollo normalised cache • Local Storage for web • AsyncStorage for React Native • SQLite on native platforms • Database can be preloaded • Offline client can be configured • WiFi only • WiFi and cellular
  • 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway AWS AppSync
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway AWS AppSync vs
  • 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway AWS AppSync vs
  • 35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway AWS AppSync &
  • 36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon API Gateway AWS AppSync &
  • 37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Enough Talking… https://github.com/aws-samples/aws-mobile-appsync-chat-starter-angular
  • 38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Cognito User Pools JWT Token GraphQL Schema ChatQL Conversations Table Messages Table User Conversations Table Users Table Amazon DynamoDB Queries and Mutations Subscriptions AppSync Resolvers User AWS AppSync AppSync Data Sources
  • 40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. User 1..1 1..n 1..1 1..n 1..n User Conversation Conversation Messages GraphQL Relations between NoSQL DynamoDB Tables
  • 41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo Time!
  • 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Takeaways Don’t boil the ocean. Start small and iterate on Offline (cache-and- network), Real-time and Conflict Resolution Use UI cues with Optimistic UI when Offline Take advantage of built-in GraphQL powerful features such as Connections (Pagination) and Relations (NoSQL) It’s all about the User Experience: PWAs + AppSync = J
  • 43. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank You