Meteor Reactivity
This app is a modification the default app created by meteor after meteor create app.
Sceenshot:

– Commit: 024c164
The Reactivity app saves the click counter in the server and is common to all clients. When a client clicks on the button, the other clients are updated.
In the default meteor app, the click counter is saved in locally in each client, clients don’t have a common counter.
The counter is saved in a mongodb collection on the server. The clients update the counter on the server when the button is clicked. Meteor then sends the update to all connected clients.
- create a mongo collection on client and server
- the server initializes the counter in the collection
- the counter is shown in the ‘hello’ template. Meteor updates the counter automatically
- when the button is clicked, the counter increases by 1
Update 2014-04-16 Commit: 5ffe745
This version sets up a timer on the server that triggers every 2000ms. When the trigger happens, it calls a function that updates the counter in the collection. The updates are reflected immediatly on all connected clients.
Try it:
git clone https://github.com/RemyNoulin/meteor_reactivity.git
cd meteor_reactivity
meteor