SlideShare a Scribd company logo
1 of 24
Meteor
Building real-time web apps
Nam Ho
KMS TechDay 2013
Agenda
• Play game
• Meteor
PLAY GAME
Play game at http://starwars.meteor.com/
Inspired by MMO Asteroids & Multi-touch Game Controller
http://seb.ly/2012/04/node-js-experiment-mmo-asteroids/
http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-
for-ipad/
METEOR
A Node.JS based real-time web framework
http://meteor.com/
Quick Start
$ curl https://install.meteor.com | /bin/sh
$ meteor create starwars
$ cd starwars
$ meteor
Meteor server running on: http://localhost:3000/
$ meteor deploy starwars.meteor.com
JAVASCRIPT END-TO-END
AUTOMATICALLY LOAD
JAVASCRIPT FILES UP AND RUN
Project Structure
• root
– /lib files in this folder are loaded first
– /client are only sent to the client
– /server are only run on the server
– /public static media files
– main.* are loaded last
• Deeper files are loaded first
THE VIEW
Templates
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
</template>
Data Bindings
<template name="hello">
{{greeting}}
</template>
Template.hello.greeting = “Hello World!";
Event Bindings
<template name="hello">
<input type="button" value="Click" />
</template>
Template.hello.events({
'click input': function() { alert(“pressed"); }
});
REACTIVITY
Reactive Programming
Reactive programming consists 2 basic parts
• Reactive data source
• Reactive computation
– A block of code contains reactive data sources
Anytime data changes,
reactive computation is automatically re-run.
Live View Updates
Template.hello.greeting = function() {
return Session.get(‘greeting’);
};
When changing Session value,
view updates immediately
reactive data source
reactive computation
THE MODEL
Cached and Synced Data
Server Client
Data model Data model
Changes
#1 Cache
#2 Sync
Listen
SYNCED MODEL
+
REACTIVITY
=
BANG!
PUBLISH / SUBSCRIBE
Publish a record set.
Subscribe to a record set.
// server + client: create Player model
Players = new Meteor.Collection(“players”);
// server: publish the players collection
Meteor.publish(“allplayers”, function () {
return Players.find();
});
// client: subscribe a record set
Meteor.subscribe(“allplayers”);
SERVER METHODS
Methods are remote functions that Meteor clients can invoke.
// server
Meteor.methods({
foo: function () { return “bar”; }
});
// client: async call
Meteor.call(‘foo’, function(error, result){…});
// client: sync call
var result = Meteor.call(‘foo’);
USE MONGODB AS DATABASE
Reset database: meteor reset
Shell: meteor mongo OR mongo 127.0.0.1:3002/meteor
THANK YOU!
Q & A
Source code: https://github.com/hotrannam/starwars
Twitter: @hotrannam

More Related Content

What's hot

Angular meteor for angular devs
Angular meteor for angular devsAngular meteor for angular devs
Angular meteor for angular devs
Arc & Codementor
 

What's hot (20)

Cross-Platform Desktop Apps with Electron (CodeStock Edition)
Cross-Platform Desktop Apps with Electron (CodeStock Edition)Cross-Platform Desktop Apps with Electron (CodeStock Edition)
Cross-Platform Desktop Apps with Electron (CodeStock Edition)
 
Building a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKitBuilding a Desktop Streaming console with Node.js and WebKit
Building a Desktop Streaming console with Node.js and WebKit
 
Cross-Platform Desktop Apps with Electron
Cross-Platform Desktop Apps with ElectronCross-Platform Desktop Apps with Electron
Cross-Platform Desktop Apps with Electron
 
Cross-Platform Desktop Apps with Electron
Cross-Platform Desktop Apps with ElectronCross-Platform Desktop Apps with Electron
Cross-Platform Desktop Apps with Electron
 
Building Cross Platform Apps with Electron
Building Cross Platform Apps with ElectronBuilding Cross Platform Apps with Electron
Building Cross Platform Apps with Electron
 
Microsoft Azure Container Service - DockerCH
Microsoft Azure Container Service - DockerCHMicrosoft Azure Container Service - DockerCH
Microsoft Azure Container Service - DockerCH
 
React.js for Back-End developers
React.js for Back-End developersReact.js for Back-End developers
React.js for Back-End developers
 
Meet the Selenium Grid
Meet the Selenium GridMeet the Selenium Grid
Meet the Selenium Grid
 
Managing Large Selenium Grid
Managing Large Selenium Grid�Managing Large Selenium Grid�
Managing Large Selenium Grid
 
How to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsHow to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud Solutions
 
Build An Automated Testing Pipeline
Build An Automated Testing PipelineBuild An Automated Testing Pipeline
Build An Automated Testing Pipeline
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Angular meteor for angular devs
Angular meteor for angular devsAngular meteor for angular devs
Angular meteor for angular devs
 
My early experience with Mirantis OpenStack 6.0
My early experience with Mirantis OpenStack 6.0My early experience with Mirantis OpenStack 6.0
My early experience with Mirantis OpenStack 6.0
 
Scaling and Managing Selenium Grid
Scaling and Managing Selenium GridScaling and Managing Selenium Grid
Scaling and Managing Selenium Grid
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudTaking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure Cloud
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Software that eats the world! - PerformDay Brussels
Software that eats the world! - PerformDay BrusselsSoftware that eats the world! - PerformDay Brussels
Software that eats the world! - PerformDay Brussels
 
React.js and Flux in details
React.js and Flux in detailsReact.js and Flux in details
React.js and Flux in details
 
ProtoPie with Electron
ProtoPie with ElectronProtoPie with Electron
ProtoPie with Electron
 

Viewers also liked

Viewers also liked (6)

Build and ship apps with MeteorJS, Docker and Azure
Build and ship apps with MeteorJS, Docker and AzureBuild and ship apps with MeteorJS, Docker and Azure
Build and ship apps with MeteorJS, Docker and Azure
 
Meteor
MeteorMeteor
Meteor
 
Lessons Learned About MeteorJS
Lessons Learned About MeteorJSLessons Learned About MeteorJS
Lessons Learned About MeteorJS
 
Mật thư - DoiSongTrai.NET
Mật thư - DoiSongTrai.NETMật thư - DoiSongTrai.NET
Mật thư - DoiSongTrai.NET
 
Meteor intro-2015
Meteor intro-2015Meteor intro-2015
Meteor intro-2015
 
Presentation .- meteors
Presentation  .- meteorsPresentation  .- meteors
Presentation .- meteors
 

Similar to Building real time web apps with Meteor

Meteor node upnorth-bobdavies
Meteor node upnorth-bobdaviesMeteor node upnorth-bobdavies
Meteor node upnorth-bobdavies
Mark Skeet
 
Cloudsim.pptx...........................
Cloudsim.pptx...........................Cloudsim.pptx...........................
Cloudsim.pptx...........................
HassamShahid2
 
Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015
Codemotion
 
Web dev tools review
Web dev tools reviewWeb dev tools review
Web dev tools review
Changhyun Lee
 

Similar to Building real time web apps with Meteor (20)

Meteor ddp
Meteor ddpMeteor ddp
Meteor ddp
 
Container Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in productionContainer Days Boston - Kubernetes in production
Container Days Boston - Kubernetes in production
 
Meteor node upnorth-bobdavies
Meteor node upnorth-bobdaviesMeteor node upnorth-bobdavies
Meteor node upnorth-bobdavies
 
Get started with meteor | designveloper software agency meteor prime partner
Get started with meteor | designveloper software agency   meteor prime partnerGet started with meteor | designveloper software agency   meteor prime partner
Get started with meteor | designveloper software agency meteor prime partner
 
Meteor
MeteorMeteor
Meteor
 
Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Community Tour Bologna
Community Tour BolognaCommunity Tour Bologna
Community Tour Bologna
 
Wars I’ve Seen From Java EE to Spring and more, Azure has you covered
Wars I’ve SeenFrom Java EE to Spring and more, Azure has you coveredWars I’ve SeenFrom Java EE to Spring and more, Azure has you covered
Wars I’ve Seen From Java EE to Spring and more, Azure has you covered
 
Understanding meteor
Understanding meteorUnderstanding meteor
Understanding meteor
 
Cloudsim.pptx...........................
Cloudsim.pptx...........................Cloudsim.pptx...........................
Cloudsim.pptx...........................
 
Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015
 
Meteor + Polymer
Meteor + PolymerMeteor + Polymer
Meteor + Polymer
 
Plone FSR
Plone FSRPlone FSR
Plone FSR
 
Titanium Mobile
Titanium MobileTitanium Mobile
Titanium Mobile
 
Meteor meetup
Meteor meetupMeteor meetup
Meteor meetup
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
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
 
Web dev tools review
Web dev tools reviewWeb dev tools review
Web dev tools review
 
Made with Meteor
Made with MeteorMade with Meteor
Made with Meteor
 
Sitecore 10 - ASP.NET Core Rendering with Docker and Sitecore 10
Sitecore 10 - ASP.NET Core Rendering with Docker and Sitecore 10Sitecore 10 - ASP.NET Core Rendering with Docker and Sitecore 10
Sitecore 10 - ASP.NET Core Rendering with Docker and Sitecore 10
 

More from hotrannam (6)

Applied Redis
Applied RedisApplied Redis
Applied Redis
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programming
 
Node.js
Node.jsNode.js
Node.js
 
Multi tenancy
Multi tenancyMulti tenancy
Multi tenancy
 
Ruby on Rails 3
Ruby on Rails 3Ruby on Rails 3
Ruby on Rails 3
 
jQuery plugins - templates, data link, globalization
jQuery plugins - templates, data link, globalizationjQuery plugins - templates, data link, globalization
jQuery plugins - templates, data link, globalization
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Building real time web apps with Meteor