Having watched Meteor Framework screencast. I noticed that changing the database seamlessly changes the data in browser. Usually AJAX, just reloads a part of page every few seconds but here I didn't noticed browser reloading. How did they achieve that in Meteor? Is it Node.js dependent?
UPDATE: Toby Catlin poses another interesting question. How does Meteor handle different browsers?
Meteor uses data on the wire, meaning the server sends data, not HTML, and the client renders it. Meteor embraces the ecosystem, bringing the best parts of the extremely active JavaScript community to you in a careful and considered way.
Meteor applications use Distributed Data Protocol (DDP) over a WebSocket connection.
The Meteor build process is configured almost entirely through adding and removing packages to your app and putting files in specially named directories. For example, to get all of the newest stable ES2015 JavaScript features in your app, you add the ecmascript package.
They use both Session
and Meteor.autosubscribe
(from Meteor API) to ensure that changes are reflected on the clients.
These Meteor APIs use XHR (XMLHttpRequest) by SockJS. SockJS is WebSocket emulation utility. So when something changes on the server, SockJS ensures that an XHR is sent, and the changed data is in the JSON response.
Yes, Meteor is fully dependent on Node.js. From the Meteor docs:
A Meteor application is a mix of JavaScript that runs inside a client web browser, JavaScript that runs on the Meteor server inside a Node.js container, and all the supporting HTML fragments, CSS rules, and static assets. Meteor automates the packaging and transmission of these different components. And, it is quite flexible about how you choose to structure those components in your file tree.
The only server asset is JavaScript. Meteor gathers all your JavaScript files, excluding anything under the client and public subdirectories, and loads them into a Node.js server instance inside a fiber. In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.
Sources: http://docs.meteor.com/ and https://github.com/meteor/meteor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With