SlideShare a Scribd company logo
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

PPTX
Use case 1 - for Sitecore Automation Module
PPTX
Sexy, Powerful, Exciting
PDF
Serverless side by-side extensions with Azure Durable Functions
PDF
PPSX
Electron - Build cross platform desktop apps
PDF
Sails.js Intro
PPTX
Electron
PDF
Cross-Platform Desktop Apps with Electron (CodeStock Edition)
Use case 1 - for Sitecore Automation Module
Sexy, Powerful, Exciting
Serverless side by-side extensions with Azure Durable Functions
Electron - Build cross platform desktop apps
Sails.js Intro
Electron
Cross-Platform Desktop Apps with Electron (CodeStock Edition)

What's hot (20)

PDF
Building a Desktop Streaming console with Node.js and WebKit
PPTX
Cross-Platform Desktop Apps with Electron
PDF
Cross-Platform Desktop Apps with Electron
PDF
Building Cross Platform Apps with Electron
PDF
Microsoft Azure Container Service - DockerCH
PDF
React.js for Back-End developers
PDF
Meet the Selenium Grid
PPTX
Managing Large Selenium Grid
PPTX
How to work with Selenium Grid and Cloud Solutions
PDF
Build An Automated Testing Pipeline
PDF
Meteor presentation
PDF
Angular meteor for angular devs
PDF
My early experience with Mirantis OpenStack 6.0
PPTX
Scaling and Managing Selenium Grid
PDF
Taking Spring Apps for a Spin on Microsoft Azure Cloud
PDF
Meteor presentation
PPTX
Software that eats the world! - PerformDay Brussels
PDF
React.js and Flux in details
PPTX
ProtoPie with Electron
PPTX
AWS elastic beanstalk
Building a Desktop Streaming console with Node.js and WebKit
Cross-Platform Desktop Apps with Electron
Cross-Platform Desktop Apps with Electron
Building Cross Platform Apps with Electron
Microsoft Azure Container Service - DockerCH
React.js for Back-End developers
Meet the Selenium Grid
Managing Large Selenium Grid
How to work with Selenium Grid and Cloud Solutions
Build An Automated Testing Pipeline
Meteor presentation
Angular meteor for angular devs
My early experience with Mirantis OpenStack 6.0
Scaling and Managing Selenium Grid
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Meteor presentation
Software that eats the world! - PerformDay Brussels
React.js and Flux in details
ProtoPie with Electron
AWS elastic beanstalk
Ad

Viewers also liked (6)

PDF
Build and ship apps with MeteorJS, Docker and Azure
PPTX
Lessons Learned About MeteorJS
PDF
Mật thư - DoiSongTrai.NET
PPTX
Meteor intro-2015
PPTX
Presentation .- meteors
Build and ship apps with MeteorJS, Docker and Azure
Lessons Learned About MeteorJS
Mật thư - DoiSongTrai.NET
Meteor intro-2015
Presentation .- meteors
Ad

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

PPTX
Magnificent Meteor -By Dipali Vyas (PM Zestard Technologies) for GDG Ahmedaba...
PPTX
Meteor node upnorth-bobdavies
PDF
CraftCamp for Students - Introduction to Meteor.js
PPTX
Meteor Introduction
PDF
Get started with meteor | designveloper software agency meteor prime partner
PPTX
Reactive application using meteor
PDF
Reactive Application Using METEOR
PPTX
Meteor Introduction - Ashish
PDF
Only JavaScript, only Meteor.js
PPTX
Meet with Meteor
PPTX
Building a production ready meteor app
PPTX
Why meteor
PDF
PDF
The End of Dinosaurs happened because of [a] Meteor
PPTX
PPTX
Introduction to meteor
PPTX
Plone FSR
PPTX
Meteor Day - Nov 6 at La Commune
PDF
David Glasser in Chicago - Meteor: Past, Present, & Future
ODP
code-camp-meteor
Magnificent Meteor -By Dipali Vyas (PM Zestard Technologies) for GDG Ahmedaba...
Meteor node upnorth-bobdavies
CraftCamp for Students - Introduction to Meteor.js
Meteor Introduction
Get started with meteor | designveloper software agency meteor prime partner
Reactive application using meteor
Reactive Application Using METEOR
Meteor Introduction - Ashish
Only JavaScript, only Meteor.js
Meet with Meteor
Building a production ready meteor app
Why meteor
The End of Dinosaurs happened because of [a] Meteor
Introduction to meteor
Plone FSR
Meteor Day - Nov 6 at La Commune
David Glasser in Chicago - Meteor: Past, Present, & Future
code-camp-meteor

More from hotrannam (6)

PPTX
Applied Redis
PPTX
HTML5 Programming
PPTX
Node.js
PPTX
Multi tenancy
PPTX
Ruby on Rails 3
PPTX
jQuery plugins - templates, data link, globalization
Applied Redis
HTML5 Programming
Node.js
Multi tenancy
Ruby on Rails 3
jQuery plugins - templates, data link, globalization

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation theory and applications.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
MIND Revenue Release Quarter 2 2025 Press Release
The AUB Centre for AI in Media Proposal.docx
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Big Data Technologies - Introduction.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation theory and applications.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Spectral efficient network and resource selection model in 5G networks
MIND Revenue Release Quarter 2 2025 Press Release

Building real time web apps with Meteor