2. Meteor is a platform
built on top of NodeJS
for building real-time web apps.
Building Real-Time JavaScript Web Apps
3. The real-time web is a set of technologies and
practices that enable users to receive
information as soon as it is published by its
authors, rather than requiring that they or their
software check a source periodically for
updates.
source : wikipedia
12. $ ls -l foreign-exchange/
main.html # loaded after any thing else
main.js
# loaded after any thing else
/client # runs only on client side + CSS + Templates
!
/server # runs only on server
/public # runs on both client & server + assets
/lib
# files loaded before anything else
/collections # may be to store collections
it’s not a rule but it’s a structure suggestion
19. Collections
Data is stored in Meteor in the Collection. A
collection is a special data structure that,
along with publications, takes
care of the job of synchronising real-time
data to and from each connected user's
browser and into the Mongo database.
21. Collections seen from server
On the server, the collection acts as an API into your
Mongo database.
$ meteor mongo # starts the embedded mongoDB console
>db.posts.insert({title:’Hello there !’});
>db.posts.find();
{“_id”:ObjectId(..). “title”:”Hello there !”}
MongoDB is the de facto database used by Meteor until now
22. Collections seen from client
local, in-browser cache of the real Mongo collection
MiniMongo is client-side Mongo client -use DevTools>db.posts.insert({title:’Hello there !’});
1. first insert the data in the client collection
2. tries to sync with server
3. if it’s ok then server is updated and all connected clients
else the inserted item is deleted again.
Latency Compensation
23. Collections Publications & Subscriptions 1
$ meteor remove autopublish
Meteor.publish('posts', function() {
return Posts.find();
});
Meteor.subscribe('posts');
by default entire collections are accessible by all connected users
http://docs.meteor.com/#publishandsubscribe