SlideShare a Scribd company logo
Thin client SPAs
Stream UI using web standards
MARCIN WARPECHOWSKI, STARCOUNTER
INFOSHARE
GDAŃSK, 18.05.2016
Thin client SPAs
Stream UI using web standards
MARCIN WARPECHOWSKI, STARCOUNTER
INFOSHARE
GDAŃSK, 18.05.2016
Agenda
- discuss fat vs thin client architectural styles of web apps
- present a thin client pattern and library called “PuppetJs”
- show some code
- questions
github.com/puppetjs/puppetjs
infoshare.mysampleapp.com
Topics today
- application protocols
- user interface
Fat client SPAs
STATELESS STATE #2STATE #1
SERVER APP CLIENT APP
REST
INTERFACE
JSON
REST
CLIENT
Typical problems in REST and ROA
- Long-running transactions. I want to work in isolation until I am
ready to commit or roll back my changes.

- Data redundancy. I don’t want to send or get more information
than needed.

- Cache invalidation. I want to work on current state.
Problems of fat client
- heavy code
- duplicate logic
- increased complexity
- validation on both ends
- glue code
Thin client should be among the considered
solutions
nyctaxi.herokuapp.com
Pattern for data synchronization.
Uses JSON and JSON-Patch over
HTTP and WebSocket.
PuppetJs
Standards
PuppetJs
Pattern for data synchronization.
Uses JSON and JSON-Patch over
HTTP and WebSocket.
S T A T E
SERVER APP
WITH VIEW-MODEL
JSON VIEW
PuppetJs binds server-side view-models to HTML
Puppet flow
Demo time
JSON is low-res
- JSON has just 6 types of value:
- string
- number
- boolean
- null
- object
- array
PRIMITIVE
COMPOSITE
Benefits to productivity
- no client side app, no glue code between apps
- works great with JavaScript and Web Components
- composable nested views
Benefits to performance and UX
- morphing views
- real-time view of the data
- client patches mitigate network latency
Benefits to integrity
- security
- server is the single source of truth
- operational transformation
Puppet implementations
JavaScript: github.com/puppetjs/puppetjs
Web Components: github.com/PuppetJs/puppet-polymer-client
C#: github.com/starcounter/starcounter
Sample apps:
Hello World: github.com/warpech/HelloWorld
KitchenSink: github.com/StarcounterSamples/KitchenSink
Thanks! More info on
.io
Twitter: @starcounterdb, @warpech
Appendix
No standards were harmed during the making of
this presentation
• JSON (ECMA-404, RFC 7159)
• JSON-Patch (RFC 6902)
• HTTP (W3C and IETF, multiple RFC)
• WebSocket (RFC 6455)
Why JSON
• ubiquitous (every platform supported)
Why JSON-Patch
• 3 major operations: add, replace, remove
• 3 helper operations: copy, move, test
• a JSON-Patch is a JSON document itself
• reduces traffic
Why HTTP
• Content negotiation: text/html, application/json, application/json-
patch+json
Why WebSocket
• in contrast to HTTP, there are no message headers
• important when message is smaller than the header
• messages are delivered in the same order as they are sent
• ability to push
Standards
OK, that’s ours
but based on a well-researched principle
Pattern for remote JSON data synchronization.
Uses JSON-Patch over HTTP or WebSocket,
with optional Operational Transformation.
PuppetJs
What UI can you represent with JSON?
- text labels and inputs
- URLs
- Markdown
- HTML
- amounts
- buttons
- geographic coordinates
- checkboxes
- toggle buttons
- disabled inputs
- conditional displaying of things
STRING
NUMBER
BOOLEAN
What UI can you represent with JSON?
- nested views
- namespaces
- lists of values
- lists of views
OBJECT
ARRAY
Why Operational Transformation
• web reality: the client and the server are doing concurrent
changes asynchronously (most of the time out-of-sync)
• goal: apply patches correctly without freezing UI or disallowing
server push
• how does it work: transforms any remote operation over
operations that were generated locally
Without Operational Transformation
CLIENT SERVER
“ABCDE” “ABCDE”
“ABCE” “ACDE”
“ACD”“ACE”
C = Del 4 S = Del 2
S = Del 2 C = Del 4
TIME
With Operational Transformation
CLIENT SERVER
TIME
“ABCDE” “ABCDE”
“ABCE” “ACDE”
“ACD”“ACE”
C = Del 4 S = Del 2
S’ = Del 2 C’ = Del 3
Fat client SPAs
SERVER APP CLIENT APP
REST
INTERFACE
JSON
REST
CLIENT

More Related Content

PDF
Thin client SPAs? Stream UI using web standards (CodeNight)
PDF
Building Asynchronous Microservices with Armeria
PPT
Zing Database – Distributed Key-Value Database
PPTX
Wordcamp2009
PDF
Introduction to Web Sockets
PPTX
Web Sockets
PPT
How to push data to a browser
Thin client SPAs? Stream UI using web standards (CodeNight)
Building Asynchronous Microservices with Armeria
Zing Database – Distributed Key-Value Database
Wordcamp2009
Introduction to Web Sockets
Web Sockets
How to push data to a browser

What's hot (20)

PPT
ZaloPay Merchant Platform on K8S on-premise
PDF
Jayway Web Tech Radar 2015
PPTX
Rapid Application Development with MEAN Stack
PPTX
A faster web
PDF
Headless approach for offloading heavy tasks in Magento
PDF
Headless Magento - Meet Magento Poland 2017
PDF
The MEAN stack - SoCalCodeCamp - june 29th 2014
PDF
PAC 2019 virtual Mark Tomlinson
PDF
Scaling a Web Service
PDF
A Gentle Introduction to Functions-as-a-Service
PPTX
Experience lessons from architecture of zalo real time system
PDF
Thin Server Architecture SPA, 5 years old presentation
KEY
Thin Server Architecture
PPT
VFP & Ajax
PDF
2deHands.be - Tuning a Big Classifieds Site
PDF
React Introduction
PPTX
Mciro Services & Zookeeper
PDF
Wcf remaining
PPTX
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
ODP
Compress
ZaloPay Merchant Platform on K8S on-premise
Jayway Web Tech Radar 2015
Rapid Application Development with MEAN Stack
A faster web
Headless approach for offloading heavy tasks in Magento
Headless Magento - Meet Magento Poland 2017
The MEAN stack - SoCalCodeCamp - june 29th 2014
PAC 2019 virtual Mark Tomlinson
Scaling a Web Service
A Gentle Introduction to Functions-as-a-Service
Experience lessons from architecture of zalo real time system
Thin Server Architecture SPA, 5 years old presentation
Thin Server Architecture
VFP & Ajax
2deHands.be - Tuning a Big Classifieds Site
React Introduction
Mciro Services & Zookeeper
Wcf remaining
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
Compress
Ad

Viewers also liked (9)

PDF
LogicProgrammingShortestPathEfficiency
PDF
My favorites
PDF
писукову дмитрию
PDF
Estadistica religion y_moral_catolica_cr2015-2016
DOCX
PDF
Outros Certificados em Inglês
DOC
st-marine_3rd Officer Panush Vyacheslav CV_form_
PPTX
Issues and Challenges in Implementing Electronic Health Record in Primary Care
PPTX
Help your scrum team strike oil!
LogicProgrammingShortestPathEfficiency
My favorites
писукову дмитрию
Estadistica religion y_moral_catolica_cr2015-2016
Outros Certificados em Inglês
st-marine_3rd Officer Panush Vyacheslav CV_form_
Issues and Challenges in Implementing Electronic Health Record in Primary Care
Help your scrum team strike oil!
Ad

Similar to Thin client SPAs. Stream UI using web standards (20)

PDF
Puppet – Make stateful apps easier than stateless
PDF
REST - What's It All About? (SAP TechEd 2012, CD110)
PDF
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
PDF
Post-relational databases: What's wrong with web development? v3
PDF
PHP is the King, nodejs is the Prince and Lua is the fool
PDF
Post-relational databases: What's wrong with web development?
PDF
Business-friendly library for inter-service communication
PPTX
IP based standards for IoT
PPTX
Technology Stack Discussion
PDF
OSMC 2010 | Monitoring mit Icinga by Icinga Team
PPTX
Angular jS Introduction by Google
 
PDF
Yet another json rpc library (mole rpc)
PDF
apidays LIVE Paris - GraphQL meshes by Jens Neuse
PPT
Would Mr. Spok choose Open Source
PDF
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
PDF
RESTful applications: The why and how by Maikel Mardjan
PPTX
REST: So What's It All About? (SAP TechEd 2011, MOB107)
PPTX
HTML5, HTTP2, and You 1.1
PDF
Server and client rendering of single page apps
Puppet – Make stateful apps easier than stateless
REST - What's It All About? (SAP TechEd 2012, CD110)
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
Post-relational databases: What's wrong with web development? v3
PHP is the King, nodejs is the Prince and Lua is the fool
Post-relational databases: What's wrong with web development?
Business-friendly library for inter-service communication
IP based standards for IoT
Technology Stack Discussion
OSMC 2010 | Monitoring mit Icinga by Icinga Team
Angular jS Introduction by Google
 
Yet another json rpc library (mole rpc)
apidays LIVE Paris - GraphQL meshes by Jens Neuse
Would Mr. Spok choose Open Source
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
RESTful applications: The why and how by Maikel Mardjan
REST: So What's It All About? (SAP TechEd 2011, MOB107)
HTML5, HTTP2, and You 1.1
Server and client rendering of single page apps

Recently uploaded (20)

PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
PPT on Performance Review to get promotions
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
web development for engineering and engineering
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT 4 Total Quality Management .pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
CH1 Production IntroductoryConcepts.pptx
PPT on Performance Review to get promotions
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
web development for engineering and engineering
Automation-in-Manufacturing-Chapter-Introduction.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Embodied AI: Ushering in the Next Era of Intelligent Systems
Safety Seminar civil to be ensured for safe working.
Foundation to blockchain - A guide to Blockchain Tech
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT 4 Total Quality Management .pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

Thin client SPAs. Stream UI using web standards

  • 1. Thin client SPAs Stream UI using web standards MARCIN WARPECHOWSKI, STARCOUNTER INFOSHARE GDAŃSK, 18.05.2016
  • 2. Thin client SPAs Stream UI using web standards MARCIN WARPECHOWSKI, STARCOUNTER INFOSHARE GDAŃSK, 18.05.2016
  • 3. Agenda - discuss fat vs thin client architectural styles of web apps - present a thin client pattern and library called “PuppetJs” - show some code - questions github.com/puppetjs/puppetjs infoshare.mysampleapp.com
  • 4. Topics today - application protocols - user interface
  • 5. Fat client SPAs STATELESS STATE #2STATE #1 SERVER APP CLIENT APP REST INTERFACE JSON REST CLIENT
  • 6. Typical problems in REST and ROA - Long-running transactions. I want to work in isolation until I am ready to commit or roll back my changes.
 - Data redundancy. I don’t want to send or get more information than needed.
 - Cache invalidation. I want to work on current state.
  • 7. Problems of fat client - heavy code - duplicate logic - increased complexity - validation on both ends - glue code
  • 8. Thin client should be among the considered solutions nyctaxi.herokuapp.com
  • 9. Pattern for data synchronization. Uses JSON and JSON-Patch over HTTP and WebSocket. PuppetJs
  • 10. Standards PuppetJs Pattern for data synchronization. Uses JSON and JSON-Patch over HTTP and WebSocket.
  • 11. S T A T E SERVER APP WITH VIEW-MODEL JSON VIEW PuppetJs binds server-side view-models to HTML
  • 14. JSON is low-res - JSON has just 6 types of value: - string - number - boolean - null - object - array PRIMITIVE COMPOSITE
  • 15. Benefits to productivity - no client side app, no glue code between apps - works great with JavaScript and Web Components - composable nested views
  • 16. Benefits to performance and UX - morphing views - real-time view of the data - client patches mitigate network latency
  • 17. Benefits to integrity - security - server is the single source of truth - operational transformation
  • 18. Puppet implementations JavaScript: github.com/puppetjs/puppetjs Web Components: github.com/PuppetJs/puppet-polymer-client C#: github.com/starcounter/starcounter Sample apps: Hello World: github.com/warpech/HelloWorld KitchenSink: github.com/StarcounterSamples/KitchenSink
  • 19. Thanks! More info on .io Twitter: @starcounterdb, @warpech
  • 21. No standards were harmed during the making of this presentation • JSON (ECMA-404, RFC 7159) • JSON-Patch (RFC 6902) • HTTP (W3C and IETF, multiple RFC) • WebSocket (RFC 6455)
  • 22. Why JSON • ubiquitous (every platform supported)
  • 23. Why JSON-Patch • 3 major operations: add, replace, remove • 3 helper operations: copy, move, test • a JSON-Patch is a JSON document itself • reduces traffic
  • 24. Why HTTP • Content negotiation: text/html, application/json, application/json- patch+json
  • 25. Why WebSocket • in contrast to HTTP, there are no message headers • important when message is smaller than the header • messages are delivered in the same order as they are sent • ability to push
  • 26. Standards OK, that’s ours but based on a well-researched principle Pattern for remote JSON data synchronization. Uses JSON-Patch over HTTP or WebSocket, with optional Operational Transformation. PuppetJs
  • 27. What UI can you represent with JSON? - text labels and inputs - URLs - Markdown - HTML - amounts - buttons - geographic coordinates - checkboxes - toggle buttons - disabled inputs - conditional displaying of things STRING NUMBER BOOLEAN
  • 28. What UI can you represent with JSON? - nested views - namespaces - lists of values - lists of views OBJECT ARRAY
  • 29. Why Operational Transformation • web reality: the client and the server are doing concurrent changes asynchronously (most of the time out-of-sync) • goal: apply patches correctly without freezing UI or disallowing server push • how does it work: transforms any remote operation over operations that were generated locally
  • 30. Without Operational Transformation CLIENT SERVER “ABCDE” “ABCDE” “ABCE” “ACDE” “ACD”“ACE” C = Del 4 S = Del 2 S = Del 2 C = Del 4 TIME
  • 31. With Operational Transformation CLIENT SERVER TIME “ABCDE” “ABCDE” “ABCE” “ACDE” “ACD”“ACE” C = Del 4 S = Del 2 S’ = Del 2 C’ = Del 3
  • 32. Fat client SPAs SERVER APP CLIENT APP REST INTERFACE JSON REST CLIENT