SlideShare a Scribd company logo
N U R T U R E V E N T U R E
METEORThe Meteor Revolution
Massimo Sgrelli @ NURTURE VENTURE
meteorlog.com
Towards Connected Clients
•Model View Controller (MVC)
• Changed in the last 5 years
•How?
• Most modern applications moved the Model on the client and access
the server through API
• Many Javascript frameworks pop up to address this need
• Some frameworks like Rails still keep most of the login on the server
•Why move things on the client?
• To reduce latency and provide responsive applications
meteorlog.com
What’s Meteor
Meteor is a platform to build web and mobile
applications using just Javascript.
It’s been built on top of Nodejs.
•What’s a platform?
•Why is it different from a framework?
meteorlog.com
A Platform
•A framework
• Simplifies app creation
• Solves part of the problem
•A platform
• Provides you the building block to build a complete application
• It’s all-in-one solution for a broad range of problems
Meteor is a modular platform. It provides its own solutions, but it’s
open to integration with other frameworks like Angular and React.
meteorlog.com
How We Got Here
•’70 Mainframe era
• DB, network, dumb terminals
• 3270
•’80 Client-Server era
• DBDB, network, fat client applications
• Corba, DCOM, structure data sent
•’90 Web era
• DB, LAMP, HTTP/TCP, browsers
• HTML, data
•NOW
• DB
• Mobile = a whole computer again
APP
SCREENS
APP
RPC, CORBA, DCOM
LAMP
HTTP/TCP
DATA, WHY HTTP !?!
API
meteorlog.com
No Refresh Button
•2015 ~ ’80
• We need to move data
• Different users using iOS, Android, HTML …
• You don’t push the refresh button anymore. It just happen that
your data get updated when needed
APP
APP
APP
APP
meteorlog.com
Applications: What Changed
•They use (massively)
• Live updating
• Collaborative techniques
• Mobile
•They move data in real time, back and forth,
between server and client(s)
meteorlog.com
Meteor Architecture
APP
HOW HTTP WORKS
GET/POST
200OK ….
• It was designed to get documents
• Pretty simple
meteorlog.com
Meteor Architecture
APP
DDP (Distributed Data Protocol)
• DDP runs over web sockets (not HTTP)
• DDP is a simple protocol for fetching structured data
from a server and receiving live updates when those
data change.
web socket APP
meteorlog.com
Just in Case You Don’t Know…
•Socket
• 2 end points can talk to each other over a wire/pipe
• Data are sent in order, reliably and with no changes
•Web Socket
• You can do the same between a web browser and a point in the
cloud
meteorlog.com
How DDP Works
•Publication
• Client subscribe a Publication from the server
• Server starts exchanging data and messages (added, changed, remove)
• Ex. Subscribe Leaderboard publications: scores —> clients
•RPCs
• Client and server can call remote “methods”
• Ex. addToScore() <—
• Ex. result() —>
•JSON data are exchanged
feedthefounders
N U R T U R E V E N T U R E
DDP is like "REST for websockets"
It standardizes how real time
applications should talk to each other.
… or let’s say it’s just a few JSON
messages over a websocket.
meteorlog.com
Data
•How does data move?
•Where does it come from?
APP DDP APP
PUBLISH SUBSCRIBE
meteorlog.com
Respond To Changes Real Time
•The usual way it’s a lot of code to create a pub/sub mechanism using
some web socket library
•Reactive data
• As soon as data changes at the server, they are sent to clients subscribing those data
• HOW: Observable queries
DATA CHANGESPUBLISH SUBSCRIBE
meteorlog.com
Watch for data changes
{
name : “Max”,
score : 10
}
{
name : “Alex”,
score : 20
}
• MongoDB doesn’t do that
• How to change a traditional database in a real time database?
meteorlog.com
Observing DB Changes
•Poll & Diff —> Expensive
• Computation and cost on the wire
• Latency
•OpLog Tailing
• Mongo admits a log for every
update it makes to the db
MASTER
SECONDARY SECONDARY
MONGO OPLOG
meteorlog.com
Latency is Still a Problem
MONGO
SECONDARY SECONDARY
METEOR HOOKS
UP HERE
100-200ms
APPAPP
CHANGE {name:”Max, score:15}
DATA CHANGED {name:”Max, score:15}
How do we solve
this?
meteorlog.com
How Meteor Solves This
MONGO
SECONDARY SECONDARY
METEOR HOOKS
UP HERE
100-200ms
APPAPP
LOCAL CACHE
(MINI MONGO)
The query language on the
client is the same API you
have at the server – Mongo
syntax :)
LIVEQUERY
meteorlog.com
Some Advantages of This Approach
•Code sharing
• This mechanism allows to share code between client and server
• Javascript both on client and server
• Mongo syntax between client and server
•Livequery
• Turns your database into a reactive database, with streaming
queries
• Mongo, Redis (experimental) + more on the way
meteorlog.com
Some Advantages of This Approach
•Latency compensation
• On the client first (fork), than server
• If the server fails, the client rolls back
Mini Mongo
SpeculationTruth
MONGO
Fork
meteorlog.com
Reactive Templating
•Blaze
• Make your templates reactive thanks to Tracker (1K library for transparent
reactive programming)
• Same purpose as Angular, Backbone, Ember, React, Polymer …
• Spacebar: Handlebar dialect + reactivity
• Great separation between UI and code
<template name="messages">
{{#if Template.subscriptionsReady}}
{{#each messages}}
{{> message}}
{{/each}}
{{/if}}
</template>
meteorlog.com
Transparent Reactive Programming?
•Reactive data binding
• Blaze to automatically set up callbacks to detect changes to the
template's data sources, recompute any values affected by the
change, and patch the DOM in place with the update.
•Template
• HTML file with Spacebar syntax
• Template manager file for event management and callbacks
(helpers) invoked every time a reactive data source changes
meteorlog.com
Application Directory Structure
./client
./server
./public
./private
./tests
everything else is loaded with on the client and the server:
./lib
meteorlog.com
A Sample <template name="messages">
{{#if Template.subscriptionsReady}}
{{#each messages}}
{{> message}}
{{/each}}
{{/if}}
</template>
<template name="message">
<div class="message">
<span id =“{{_id}}">{{{messageBody}}}</span>
</div>
</template>
Template.messages.onCreated(function() {
this.subscribe(‘messages’)
});
Template.messages.helpers({
‘messages’ : function() {
return Messages.find();
}
});
Template.message.helpers({
‘messageBody’ : function() {
return this.messageBody;
}
});
Messages = new Mongo.Collection(‘messages’);
Messages.publish(‘messages’, function() {
if (! this.userId) return this.ready();
return Message.find();
});
//SERVER
//CLIENT
//CLIENT AND SERVER
N U R T U R E V E N T U R E
INSTALL METEOR & START
HAVING FUN
Send me your questions to massimo.sgrelli@gmail.com
www.meteorlog.com
www.nurtureventure.com

More Related Content

What's hot

Building a Web Application with Kafka as your Database
Building a Web Application with Kafka as your DatabaseBuilding a Web Application with Kafka as your Database
Building a Web Application with Kafka as your Databaseconfluent
 
React + Flux = Joy
React + Flux = JoyReact + Flux = Joy
React + Flux = JoyJohn Need
 
Reactive Integrations - Caveats and bumps in the road explained
Reactive Integrations - Caveats and bumps in the road explained  Reactive Integrations - Caveats and bumps in the road explained
Reactive Integrations - Caveats and bumps in the road explained Markus Eisele
 
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...Ralph Monaco
 
Top 15 Exchange Questions that Senior Admin ask - Jaap Wesselius
Top 15 Exchange Questions that Senior Admin ask - Jaap WesseliusTop 15 Exchange Questions that Senior Admin ask - Jaap Wesselius
Top 15 Exchange Questions that Senior Admin ask - Jaap WesseliusKemp
 
R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?Olexandra Dmytrenko
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NETAlessandro Giorgetti
 
URP? Excuse You! The Three Metrics You Have to Know
URP? Excuse You! The Three Metrics You Have to Know URP? Excuse You! The Three Metrics You Have to Know
URP? Excuse You! The Three Metrics You Have to Know confluent
 
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
Stateful, Stateless and Serverless - Running Apache Kafka® on KubernetesStateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetesconfluent
 
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...LINE Corporation
 
Internet without internet
Internet without internetInternet without internet
Internet without internetXavier Coureau
 
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...VoltDB
 
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...HostedbyConfluent
 
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)Bill Condo
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableFlowable
 
Schemas Beyond The Edge
Schemas Beyond The EdgeSchemas Beyond The Edge
Schemas Beyond The Edgeconfluent
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15streamdata.io
 
Web-centric application architectures
Web-centric application architecturesWeb-centric application architectures
Web-centric application architecturesKosala Nuwan Perera
 
Can you build a Intranet with Modern SharePoint
Can you build a Intranet with Modern SharePointCan you build a Intranet with Modern SharePoint
Can you build a Intranet with Modern SharePointKnut Relbe-Moe [MVP, MCT]
 
Multi-DC Kafka
Multi-DC KafkaMulti-DC Kafka
Multi-DC Kafkaconfluent
 

What's hot (20)

Building a Web Application with Kafka as your Database
Building a Web Application with Kafka as your DatabaseBuilding a Web Application with Kafka as your Database
Building a Web Application with Kafka as your Database
 
React + Flux = Joy
React + Flux = JoyReact + Flux = Joy
React + Flux = Joy
 
Reactive Integrations - Caveats and bumps in the road explained
Reactive Integrations - Caveats and bumps in the road explained  Reactive Integrations - Caveats and bumps in the road explained
Reactive Integrations - Caveats and bumps in the road explained
 
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...
NYLI & The Cloud: Leveraging SaaS for Disaster Recovery, Cost Savings, and An...
 
Top 15 Exchange Questions that Senior Admin ask - Jaap Wesselius
Top 15 Exchange Questions that Senior Admin ask - Jaap WesseliusTop 15 Exchange Questions that Senior Admin ask - Jaap Wesselius
Top 15 Exchange Questions that Senior Admin ask - Jaap Wesselius
 
R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?R2DBC - Good Enough for Production?
R2DBC - Good Enough for Production?
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET
 
URP? Excuse You! The Three Metrics You Have to Know
URP? Excuse You! The Three Metrics You Have to Know URP? Excuse You! The Three Metrics You Have to Know
URP? Excuse You! The Three Metrics You Have to Know
 
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
Stateful, Stateless and Serverless - Running Apache Kafka® on KubernetesStateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
 
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
 
Internet without internet
Internet without internetInternet without internet
Internet without internet
 
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...
Kyle Kingsbury Talks about the Jepsen Test: What VoltDB Learned About Data Ac...
 
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...
Transformation During a Global Pandemic | Ashish Pandit and Scott Lee, Univer...
 
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with Flowable
 
Schemas Beyond The Edge
Schemas Beyond The EdgeSchemas Beyond The Edge
Schemas Beyond The Edge
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15
 
Web-centric application architectures
Web-centric application architecturesWeb-centric application architectures
Web-centric application architectures
 
Can you build a Intranet with Modern SharePoint
Can you build a Intranet with Modern SharePointCan you build a Intranet with Modern SharePoint
Can you build a Intranet with Modern SharePoint
 
Multi-DC Kafka
Multi-DC KafkaMulti-DC Kafka
Multi-DC Kafka
 

Similar to Meteor Revolution: From DDP to Blaze Reactive Rendering

Puppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than statelessPuppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than statelessStarcounter
 
ReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOMReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOMMarc Cyr
 
Architectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym ZhiltsovArchitectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym ZhiltsovLohika_Odessa_TechTalks
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceTim Callaghan
 
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularMark Leusink
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Plone FSR
Plone FSRPlone FSR
Plone FSRfulv
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
Microservices - opportunities, dilemmas and problems
Microservices - opportunities, dilemmas and problemsMicroservices - opportunities, dilemmas and problems
Microservices - opportunities, dilemmas and problemsŁukasz Sowa
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsSashko Stubailo
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...Mark Roden
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...Mark Leusink
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 

Similar to Meteor Revolution: From DDP to Blaze Reactive Rendering (20)

Meteor + React
Meteor + ReactMeteor + React
Meteor + React
 
Puppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than statelessPuppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than stateless
 
ReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOMReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS - Re-rendering pages in the age of the mutable DOM
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
Architectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym ZhiltsovArchitectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym Zhiltsov
 
React js
React jsReact js
React js
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB Performance
 
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Plone FSR
Plone FSRPlone FSR
Plone FSR
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
Microservices - opportunities, dilemmas and problems
Microservices - opportunities, dilemmas and problemsMicroservices - opportunities, dilemmas and problems
Microservices - opportunities, dilemmas and problems
 
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
 
Meteor meetup
Meteor meetupMeteor meetup
Meteor meetup
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
Reactive Spring 5
Reactive Spring 5Reactive Spring 5
Reactive Spring 5
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 

More from Massimo Sgrelli

Start Small Get Big Night partendo da Brescia
Start Small Get Big Night partendo da BresciaStart Small Get Big Night partendo da Brescia
Start Small Get Big Night partendo da BresciaMassimo Sgrelli
 
Presentazione al meeting Web De BS
Presentazione al meeting Web De BSPresentazione al meeting Web De BS
Presentazione al meeting Web De BSMassimo Sgrelli
 
Startupweekend 2011 brescia
Startupweekend 2011 bresciaStartupweekend 2011 brescia
Startupweekend 2011 bresciaMassimo Sgrelli
 
Make Italian Internet startups succeed for real
Make Italian Internet startups succeed for realMake Italian Internet startups succeed for real
Make Italian Internet startups succeed for realMassimo Sgrelli
 

More from Massimo Sgrelli (6)

Start Small Get Big Night partendo da Brescia
Start Small Get Big Night partendo da BresciaStart Small Get Big Night partendo da Brescia
Start Small Get Big Night partendo da Brescia
 
Master startup brescia
Master startup bresciaMaster startup brescia
Master startup brescia
 
Presentazione al meeting Web De BS
Presentazione al meeting Web De BSPresentazione al meeting Web De BS
Presentazione al meeting Web De BS
 
Anatomy of a good pitch
Anatomy of a good pitchAnatomy of a good pitch
Anatomy of a good pitch
 
Startupweekend 2011 brescia
Startupweekend 2011 bresciaStartupweekend 2011 brescia
Startupweekend 2011 brescia
 
Make Italian Internet startups succeed for real
Make Italian Internet startups succeed for realMake Italian Internet startups succeed for real
Make Italian Internet startups succeed for real
 

Recently uploaded

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxAbida Shariff
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsVlad Stirbu
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaRTTS
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
 

Recently uploaded (20)

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

Meteor Revolution: From DDP to Blaze Reactive Rendering

  • 1. N U R T U R E V E N T U R E METEORThe Meteor Revolution Massimo Sgrelli @ NURTURE VENTURE
  • 2. meteorlog.com Towards Connected Clients •Model View Controller (MVC) • Changed in the last 5 years •How? • Most modern applications moved the Model on the client and access the server through API • Many Javascript frameworks pop up to address this need • Some frameworks like Rails still keep most of the login on the server •Why move things on the client? • To reduce latency and provide responsive applications
  • 3. meteorlog.com What’s Meteor Meteor is a platform to build web and mobile applications using just Javascript. It’s been built on top of Nodejs. •What’s a platform? •Why is it different from a framework?
  • 4. meteorlog.com A Platform •A framework • Simplifies app creation • Solves part of the problem •A platform • Provides you the building block to build a complete application • It’s all-in-one solution for a broad range of problems Meteor is a modular platform. It provides its own solutions, but it’s open to integration with other frameworks like Angular and React.
  • 5. meteorlog.com How We Got Here •’70 Mainframe era • DB, network, dumb terminals • 3270 •’80 Client-Server era • DBDB, network, fat client applications • Corba, DCOM, structure data sent •’90 Web era • DB, LAMP, HTTP/TCP, browsers • HTML, data •NOW • DB • Mobile = a whole computer again APP SCREENS APP RPC, CORBA, DCOM LAMP HTTP/TCP DATA, WHY HTTP !?! API
  • 6. meteorlog.com No Refresh Button •2015 ~ ’80 • We need to move data • Different users using iOS, Android, HTML … • You don’t push the refresh button anymore. It just happen that your data get updated when needed APP APP APP APP
  • 7. meteorlog.com Applications: What Changed •They use (massively) • Live updating • Collaborative techniques • Mobile •They move data in real time, back and forth, between server and client(s)
  • 8. meteorlog.com Meteor Architecture APP HOW HTTP WORKS GET/POST 200OK …. • It was designed to get documents • Pretty simple
  • 9. meteorlog.com Meteor Architecture APP DDP (Distributed Data Protocol) • DDP runs over web sockets (not HTTP) • DDP is a simple protocol for fetching structured data from a server and receiving live updates when those data change. web socket APP
  • 10. meteorlog.com Just in Case You Don’t Know… •Socket • 2 end points can talk to each other over a wire/pipe • Data are sent in order, reliably and with no changes •Web Socket • You can do the same between a web browser and a point in the cloud
  • 11. meteorlog.com How DDP Works •Publication • Client subscribe a Publication from the server • Server starts exchanging data and messages (added, changed, remove) • Ex. Subscribe Leaderboard publications: scores —> clients •RPCs • Client and server can call remote “methods” • Ex. addToScore() <— • Ex. result() —> •JSON data are exchanged
  • 12. feedthefounders N U R T U R E V E N T U R E DDP is like "REST for websockets" It standardizes how real time applications should talk to each other. … or let’s say it’s just a few JSON messages over a websocket.
  • 13. meteorlog.com Data •How does data move? •Where does it come from? APP DDP APP PUBLISH SUBSCRIBE
  • 14. meteorlog.com Respond To Changes Real Time •The usual way it’s a lot of code to create a pub/sub mechanism using some web socket library •Reactive data • As soon as data changes at the server, they are sent to clients subscribing those data • HOW: Observable queries DATA CHANGESPUBLISH SUBSCRIBE
  • 15. meteorlog.com Watch for data changes { name : “Max”, score : 10 } { name : “Alex”, score : 20 } • MongoDB doesn’t do that • How to change a traditional database in a real time database?
  • 16. meteorlog.com Observing DB Changes •Poll & Diff —> Expensive • Computation and cost on the wire • Latency •OpLog Tailing • Mongo admits a log for every update it makes to the db MASTER SECONDARY SECONDARY MONGO OPLOG
  • 17. meteorlog.com Latency is Still a Problem MONGO SECONDARY SECONDARY METEOR HOOKS UP HERE 100-200ms APPAPP CHANGE {name:”Max, score:15} DATA CHANGED {name:”Max, score:15} How do we solve this?
  • 18. meteorlog.com How Meteor Solves This MONGO SECONDARY SECONDARY METEOR HOOKS UP HERE 100-200ms APPAPP LOCAL CACHE (MINI MONGO) The query language on the client is the same API you have at the server – Mongo syntax :) LIVEQUERY
  • 19. meteorlog.com Some Advantages of This Approach •Code sharing • This mechanism allows to share code between client and server • Javascript both on client and server • Mongo syntax between client and server •Livequery • Turns your database into a reactive database, with streaming queries • Mongo, Redis (experimental) + more on the way
  • 20. meteorlog.com Some Advantages of This Approach •Latency compensation • On the client first (fork), than server • If the server fails, the client rolls back Mini Mongo SpeculationTruth MONGO Fork
  • 21. meteorlog.com Reactive Templating •Blaze • Make your templates reactive thanks to Tracker (1K library for transparent reactive programming) • Same purpose as Angular, Backbone, Ember, React, Polymer … • Spacebar: Handlebar dialect + reactivity • Great separation between UI and code <template name="messages"> {{#if Template.subscriptionsReady}} {{#each messages}} {{> message}} {{/each}} {{/if}} </template>
  • 22. meteorlog.com Transparent Reactive Programming? •Reactive data binding • Blaze to automatically set up callbacks to detect changes to the template's data sources, recompute any values affected by the change, and patch the DOM in place with the update. •Template • HTML file with Spacebar syntax • Template manager file for event management and callbacks (helpers) invoked every time a reactive data source changes
  • 24. meteorlog.com A Sample <template name="messages"> {{#if Template.subscriptionsReady}} {{#each messages}} {{> message}} {{/each}} {{/if}} </template> <template name="message"> <div class="message"> <span id =“{{_id}}">{{{messageBody}}}</span> </div> </template> Template.messages.onCreated(function() { this.subscribe(‘messages’) }); Template.messages.helpers({ ‘messages’ : function() { return Messages.find(); } }); Template.message.helpers({ ‘messageBody’ : function() { return this.messageBody; } }); Messages = new Mongo.Collection(‘messages’); Messages.publish(‘messages’, function() { if (! this.userId) return this.ready(); return Message.find(); }); //SERVER //CLIENT //CLIENT AND SERVER
  • 25. N U R T U R E V E N T U R E INSTALL METEOR & START HAVING FUN Send me your questions to massimo.sgrelli@gmail.com www.meteorlog.com www.nurtureventure.com